#include #include #include typedef struct Expression //定义表达式结构体 { int num[64]; char ch[64]; }Exper; typedef struct node //定义字栈 { char e[100]; int top; }linkstack; typedef struct Node //定义整数栈 { int c[100]; int top; }link; char precede(char a,char b) //符号判断 { int i=0,j=0; char sign[]="+-*/()^%"; char prec[8][8]={">>()>>()>>",">>>>()>>"}; if (b=='=') { return 0; } while(sign[i]
=a) { i++; } while (sign[j]
=b) { j++; } return(prec[i][j]); } void push1(linkstack *p,char c) //字符入栈 { p->e[p->top++]=c; } void push2(link *p,int num) //整数入栈 { p->c[p->top++]=num; } char gettop(linkstack *s) //读字符栈顶的元素 { char c; c=s->e[s->top-1]; return(c); } char pop1(linkstack *s) //字符出栈 { char c; c=s->e[--s->top]; return(c); } int pop2(link *N) //整数入栈 { int num; num=N->c[--N->top]; return(num); } int oper