#include #include #include struct stack { char data[100]; int top; }; void push(struct stack *s, char x) { s->data[++s->top]=x; } char pop(struct stack *s) { return s->data[s->top--]; } int rank(char x) { if(x=='+' || x=='-'){return 0;} if(x=='*' || x=='/'){return 1;} } void convert(char c[]) { char x[100]; struct stack s; int i, j, xlen; s.top=-1; xlen=-1; for(i=0; i<=strlen(c); i++) { if(i==strlen(c)) { for(j=s.top; j>=0; j--) { char tmp; tmp=pop(&s); if(tmp!=')') x[++xlen]=tmp; } break; } if(isdigit(c[i])!=0) { push(&s, c[i]); continue; } if(c[i]=='+' || c[i]=='-' || c[i]=='*' || c[i]=='/') { if(rank(c[i])>=rank(s.data[s.top]) || rank(s.data[s.top])=='(') { push(&s, c[i]); continue; } if(rank(c[i])