write program in c++or c

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ASIM ABBAS
    New Member
    • Oct 2008
    • 10

    write program in c++or c

    sri my questuon is that
    write a program in corc++
    to check wether a relation is equlance or not using two dimensional array
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by ASIM ABBAS
    sri my questuon is that
    write a program in corc++
    to check wether a relation is equlance or not using two dimensional array
    What is 'equlance'? Please proofread your question before you dump your
    ill formed text in this forum.

    Jos (moderator)

    Comment

    • newb16
      Contributor
      • Jul 2008
      • 687

      #3
      Originally posted by JosAH
      What is 'equlance'? Please proofread your question before you dump your
      ill formed text in this forum.
      It is "equivalenc e" but it doesn't help much - relation between what and what is must know.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by newb16
        It is "equivalenc e" but it doesn't help much - relation between what and what is must know.
        Ah, ok, that is easy then: for a binary relation R(x, y) check whether or not for
        any a and b:

        1) R(a, a)
        2) if R(a,b) then R(b,a)
        3) if R(a,b) and R(b,c) then R(a,c)

        The OP should be able to loop over his/her matrix and check the above criteria.

        kind regards,

        Jos

        Comment

        • ASIM ABBAS
          New Member
          • Oct 2008
          • 10

          #5
          sir ur answer explained the logic of the programme,
          but yet i do not understand how check the equalence within the programming language
          plz give some hints or if possible write the programme

          Comment

          • ASIM ABBAS
            New Member
            • Oct 2008
            • 10

            #6
            the term equalence is from discrete mathematics
            its defined as that a set is said to b equlence if it is transitive,refl exive and symmetric at the same time

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by ASIM ABBAS
              the term equalence is from discrete mathematics
              its defined as that a set is said to b equlence if it is transitive,refl exive and symmetric at the same time
              The term is 'equivalence'.

              kind regards,

              Jos

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Write a boolean function R:

                Code:
                bool R(T a, T b) { ... }
                ... such that it returns true if the relation R(a, b) holds, false otherwise. Check
                your entire matrix using this boolean function, e.g.

                1) all elements on the diagonal R(a,a) should be true
                2) for all other elements R(a,b) == R(b,a)
                3) left as an exercise to the reader.

                kind regards,

                Jos

                Comment

                Working...