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)
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!
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.
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...
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 a short MARIE program. Answer ASAP. Will upvote. This program will let the user input...
Write a short MARIE program. Answer ASAP. Will upvote. This program will let the user input two decimal values a and b. Then this program will calculate c = a + b and output the result. Q1) Write down the code which let the user input two valuesa and b. The code need to store the input values. Q2) Write down the code which calculates c = a + b. The code need to store the result into variable c....
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....