I would like to ask the code in C about truth tables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • papacologne
    New Member
    • Jan 2011
    • 5

    I would like to ask the code in C about truth tables?

    Given the truth values of the propositions p and q, display the truth values of the conjunction, disjunction, exclusive or, conditional statement, and biconditional of these propositions.

    Can you help me with this problem? Is this easy? If possible can you write the code? or if it's too long can you just help me what should i do? Thanks. I really need it badly. =D Thanks. Much Appreciated.
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Note to the OP (and only the OP):
    Please describe what the terms conjunction, disjunction, exclusive or, conditional, and biconditional mean in this context. Use whatever format is most natural for you (Boolean algebra, predicate logic, computer source code, etc).

    What language does this program need to be written in?

    Comment

    • papacologne
      New Member
      • Jan 2011
      • 5

      #3
      The program should be written in C language. Is it easy?

      Comment

      • papacologne
        New Member
        • Jan 2011
        • 5

        #4
        The truth values of the following such as when the the value of p and q is true. then i choose i.e conjuction. it will display the value of p and q. if you can give an advice on making this program in c. or just the code in c.

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          "Is it easy?"
          That depends on how complicated those 5 operations are. Please describe them to us.

          For example, here's the description of exclusive-or:
          exclusive-or = (p AND (NOT q)) OR ((NOT p) AND q)

          Meanwhile, you should familiarize yourself with the logical operators in C (!, ||, &&).

          Nobody on this site will write the code for you.

          Comment

          • papacologne
            New Member
            • Jan 2011
            • 5

            #6
            Oh. Okay to clear things up. If possible if you can give me advice on what should i do first in making the truth values work. There is no need for the symbols to be written. Just a simple input and output. Example. The program ask for the value of p and q. If p is true and q is false, then if entered the conjuction proposition, then the value given will be F. Because T and F = F. another example is if it's biconditional. if p = false <-> q = false then it will display false. Something like this. Not to be complicated. Just to make it simple. =D

            Comment

            • donbock
              Recognized Expert Top Contributor
              • Mar 2008
              • 2427

              #7
              I encourage you to write out the expressions. Doing so is half the effort of writing the program!

              Does your program need to be interactive (the user enters the values of p and q) or does your program simply print out the truth tables for these functions?

              Comment

              • papacologne
                New Member
                • Jan 2011
                • 5

                #8
                I will sooner or later when the time comes. But i need to do some basic stuff first. No. My program is interactive. Thanks in advance. Much appreciated.

                Comment

                Working...