2、
3、)"<>A;cout<#include#includeusingnamespacestd;classThesis//命题类{
4、intvalue;charname;//value:命题的真值(0/1)name:命题名public:Thesis(){value=2;name='A';};friendThesisoperator!(Thesis&q){q.invalue(1-q.getvalue());returnq;}//重载逻辑运算符friendThesisoperator&(Thesis&p,Thesis&q){p.invalue((p.getvalue()+q.getvalue())/2);returnp;}friendThesisoperator
5、(Thesis&p,Thesis&q){if(p.get
6、value()+q.getvalue()>0)p.invalue(1);elsep.invalue(0);returnp;}friendThesisoperator>(Thesis&p,Thesis&q){if(p.getvalue()==1&&q.getvalue()==0)p.invalue(0);elsep.invalue(1);returnp;}friendThesisoperator<(Thesis&p,Thesis&q){if(p.getvalue()==q.getvalue())p.invalue(1);elsep.invalue(0);returnp;}voidinv
7、alue(intx){value=x;}//输入valuevoidinname(charx){name=x;}//输入nameintgetvalue(){returnvalue;}//获取真值intgetname(){returnname;}//获取命题名};voidassignment(stringA,intN,intM,Thesisa[]);//声明函数intbds(stringA,intN,Thesisa[]);intrun(stringA,int&i,intL,intN,Thesisa[]);voidassignment(stringA,intN,intM,Thesisa[]
8、)//命题赋值并计算真值{for(intj=0;j<2;j++){a[N-1].invalue(j);if(N>1){assignment(A,N-1,M,&a[0]);}else{for(inti=0;i9、','&','>','<'};//定义运算符号集合intL;inti=0;L=strlen(&
10、A[0]);//表达式长度while(i