Question: solve using c++, thank you in advance. #include #include using namespace std; enum class logic{False,True}; enum class gate{AND, OR, NOR, NAND}; string logicToString(logic l) {
solve using c++, thank you in advance.
#include
#include
using namespace std;
enum class logic{False,True};
enum class gate{AND, OR, NOR, NAND};
string logicToString(logic l) {
// return a string for a given logical value (false,true)
}
gate stringToGate(string gateStr ) {
// converts a string representing a logical operation to a gate variable
}
logic OP(gate g, logic x, logic y) {
// this function returns the result of applying the logical operation (g)
// on the logical inputs x and y.
}
int main() {
logic x[] = { logic::False, logic::True };
logic y[] = { logic::False, logic::True };
string operation;
cin >> operation;
gate op = stringToGate(operation);
for (int i=0;i<2;i++)
for (int j = 0; j < 2; j++) {
/Write the necessary code to display the truth table for the
//gate entered by the user
}
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
