华南农业大学数据结构上机答案实验

*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;

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4