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

发布时间 : 星期三 文章华南农业大学数据结构上机答案实验更新完毕开始阅读

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