内容发布更新时间 : 2024/11/13 9:40:15星期一 下面是文章的全部内容请认真阅读。
{
return (s->top+1==size?True:False); }
int Push1(struct node1 *s,sta x) {
if(!Isfull1(s)) { s->top++;
s->a[s->top]=x;
return True; } else return False; }
int Pop1(struct node1 *s, sta *x) {
if(!Isempty1(s)) {
*x=s->a[s->top]; s->top--;
return True; } else return False; }
sta Gettop1(struct node1 *s) { sta x; if(!Isempty1(s)) {
x=s->a[s->top]; return x; } else return False; }
int In(char ch) {
if(ch>=48&&ch<=57) return True; else return False; }
char compare(char a,char b) { int i,j; char
c[7]={'+','-','*','/','(',')','#'}; char d[7][7]={
{'>','>','<','<','<','>','>'},
{'>','>','<','<','<','>','>'},
{'>','>','>','>','<','>','>'},
{'>','>','>','>','<
','>','>'},
{'<','<','<','<','<','=','@'},
{'>','>','>','>','@','>','>'},
{'<','<','<','<','<','@','='}, };
if(b=='=') return '>';
for(i=0;c[i]!=a;i++){} for(j=0;c[j]!=b;j++){}
return d[i][j]; }
sta claculat(sta a,char op,sta b) { sta m;
if(op=='+') m=a+b;
if(op=='-') m=a-b;
if(op=='*') m=a*b;
if(op=='/') m=a/b; return m; } main() {
char ch,top,op,x; int temp,d,m,n;
struct node b;
struct node *cha=&b;
struct node1 a;
struct node1 *num=&a;