Question

   Write a C++ program to generate all the truth tables needed for ( p ˄...

   Write a C++ program to generate all the truth tables needed for ( p ˄ q) ˅ (¬ p ˅ ( p ˄ ¬ q )). You need to submit your source code and a screen shot for the output

Homework Answers

Answer #1
#include <iostream>

using namespace std;

int main()
{
    cout<<"p\tq\t( p ˄ q) ˅ (¬ p ˅ ( p ˄ ¬ q ))"<<endl;
    for(int p = 0;p<=1;p++){
        for(int q=0;q<=1;q++){
            cout<<p<<"\t"<<q<<"\t"<<(( p && q) || (!p || ( p && !q )))<<endl;
        }
    }

    return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question 1 and 2 requires you to create a program ( you need to submit the...
Question 1 and 2 requires you to create a program ( you need to submit the source code and screenshot for the output), and question 3 and 4 requires solving the problems (no programs needed for those two questions). 1.Write a C++ program to construct the truth table of P ∨¬(Q ∧ R) 2.Write a C++ program to verify that the proposition P ∨¬(P ∧Q) is a tautology.
Write a C++ program to construct the truth table of P || !(Q && R)
Write a C++ program to construct the truth table of P || !(Q && R)
Let P and Q be statements: (a) Use truth tables to show that ∼ (P or...
Let P and Q be statements: (a) Use truth tables to show that ∼ (P or Q) = (∼ P) and (∼ Q). (b) Show that ∼ (P and Q) is logically equivalent to (∼ P) or (∼ Q). (c) Summarize (in words) what we have learned from parts a and b.
Write a C++ program to verify that the proposition P ∨¬(P ∧Q) is a tautology. If...
Write a C++ program to verify that the proposition P ∨¬(P ∧Q) is a tautology. If you could include comments to explain the code that would be much appreciated! :) Thank you so much!
For three statements P, Q and R, use truth tables to verify the following. (a) (P...
For three statements P, Q and R, use truth tables to verify the following. (a) (P ⇒ Q) ∧ (P ⇒ R) ≡ P ⇒ (Q ∧ R). (c) (P ⇒ Q) ∨ (P ⇒ R) ≡ P ⇒ (Q ∨ R). (e) (P ⇒ Q) ∧ (Q ⇒ R) ≡ P ⇒ R.
Collapse Write a program that prompts the user to input a positive integer. It should then...
Collapse Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd integer less than or equal to the square root of the number.) Turn in: Your source code for with The name of your program as a comment at the top...
For each of the following, write the requested program or subroutine in pseudocode (as described in...
For each of the following, write the requested program or subroutine in pseudocode (as described in Appendix A) or in a programming language that you know. Test your code either with a paper-and-pencil trace or with a computer run. 1. Write a program that will print a truth table for (p ∨ q) ⇒ r. (Use JAVA language)
Write a program that takes a string of characters (including spaces) as input, computes the frequency...
Write a program that takes a string of characters (including spaces) as input, computes the frequency of each character, sorts them by frequency, and outputs the Huffman code for each character.   When you are writing your program, you should first test it on a string of 7 characters, so you can check it. PLEASE NOTE: Your program must work for any text that has upper and lower case letters digits 0 - 9, commas, periods, and spaces. Please submit the...
Write an assembly language program that prints your full name on the screen. Use .ASII pseudo-op...
Write an assembly language program that prints your full name on the screen. Use .ASII pseudo-op to store the characters at the top of your program Use BR to branch around the characters and use STRO to output your name. Comment each line except STOP and .END. Cut and paste the Assembler Listing into your document Paste a screen shot of the Output area of the Pep8 program Please use the name "Levin Fi" Assembler Listing Screen Shot of the...
Write some C++ program segments that solves the indicated tasks (you do not have to write...
Write some C++ program segments that solves the indicated tasks (you do not have to write a complete program, nor be concerned about "good" output; a small code segment will be enough). a) A program that gets a double number from the user, decides whether that number is positive, negative, or zero and display its decision on the screen. a) A function isPositive that takes as input a double number and returns the integer 1 if the number is positive,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT