Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started