#include<stdlib.h>
#include<stdio.h>
#include<iostream.h>
#include<string.h>
#include<math.h>
#define stack_size_normal 100
#define bianliang_max 20
#define str_max 60
int zuhe[bianliang_max];//变量的取值组合数组定义;
int N;//变量个数;
//根据表达式建立的二叉树的结点定义;
typedef struct btdnode{
char data;
struct btdnode *lchild;
struct btdnode *rchild;
}*bitree;
//识别表达式使用的堆栈定义,它存放的都是树的结构;
typedef struct lnode_optr{
struct btdnode **base; //栈中的元素都是树的结点结构;
struct btdnode **top;
int stacksize;
}sqstack;
//用于产生变量的各种取值组合;
void creatzuhe(int n)
{
int i,num=0,j=0,e;
int temp[bianliang_max];
for(i=0;i<N;i++)
zuhe[i]=0;
while(n)
{
e=n%2;
num++;
temp[j++]=e;
n=n/2;
}
j=j-1;
num=N-num;
while(j>=0)
{
e=temp[j--];
zuhe[num++]=e;
}
}
//自底向上地根据运算符地优先级来建立分子树函数;当逻辑表达式读完后-子根zigen就是一棵完整的二叉树
int k=0;//建树的标志,k=1表示第一次建立分子树,要对左右孩子的指针域处理
void create(bitree &zigen,bitree l,bitree r)
{
zigen->lchild=l;
zigen->rchild=r;//分树的链接
if(l&&r)
{
if(int(l->data)>=65&&int(l->data)<=90)
{
l->lchild=NULL;
l->rchild=NULL;
}
if(int(r->data)>=65&&int(r->data)<=90)
{
r->lchild=NULL;
r->rchild=NULL;
}
}
}
//逻辑运算符的优先级判别;
char youxianji(char lie,char hang)
{
int i,j;
char bijiao[7][7]={' ','|','&','~','(',')','#',
'|','>','<','<','<','>','>',
'&','>','>','<','<','>','>', &n