A-Z + is OR * is AND _ is → # is♁(圆圈里加个+) @ is ⊙
$ is ↑ 命题的"与非" 运算( "与非门" )
% is ↓ 命题的"或非"运算( "或非门" )
Input the source formula:
A*!S+R
Here!
8countTerms
NORMALc:(A*!S*!R)+(!A*!S*R)+(A*!S*R)+(!A*S*R)+(A*S*R)
NORMALd (A+S+R)*(A+!S+R)*(!A+!S+R)
!A+S*!R
Input the source formula:
(!A+B)_R
Here!
8countTerms
NORMALc:(!A*!B*!R)+(A*!B*!R)+(!A*B*!R)+(A*B*!R)+(!A*!B*R)+(!A*B*R)+(A*B*R)
NORMALd (!A+B+!R)
Error!
Input the source formula:
A#B
Here!
4countTerms
NORMALc:(A*!B)+(!A*B)
NORMALd (A+B)*(!A+!B)
Error!
Input the source formula:
A@B
Here!
4countTerms
NORMALc:(!A*!B)+(A*B)
NORMALd (!A+B)*(A+!B)
Error!
#include
#include
#include
#include
using namespace std;
class formulaBase
{
private:
int numVar;//The number of the variables in the formula
bool variables[100];//To store the value of the variables
string sourceFormula;
string normalCFormula;
string normalDFormula;
string dualFormula;
vector vctofVar;
vector vctofPoland;
stack stk;
bool isVar(char ch)const;
void addMin(int minterm);
void addMax(int maxterm);
bool compute(int minterm);
void getInversePoland();
int countTerms(int n);
void assign(int minterm);
stack boolStk;
public:
formulaBase();
formulaBase(const formulaBase& rhs);
formulaBase();
void getSource();
string generateNormalC();
string generateNormalD();
string getDual();
void printSource()const{cout