Reference no: EM132208385
Question :
Write a program in C++ that will output the truth table for a simple wff. There will only be Ps and Qs, so you can hard code the P truth table and the Q truth table into arrays.
The user will use A for ^ , O for V, N for ' , & I for -> .
Hint: Read the first character, load the appropriate truth table into the first working array. Read the next character. If it is an N, output the negation of the first working array.
If it is a P or Q, oad the appropriate truth table into the second working, array, then read the last character and output the appropriate truth table.
Expression Would be input as
P^Q PQA
P' PN
Q->P QPI
Example runs (note the user input is bold)
Run 1
Please input the wff: PQA
The truth table is
T
F
F
F
Run 2
Please input the wff: P'
The truth table is
F
F
T
T