#include "stack.h" #include "stdio.h" #include "conoe.h" #include "stack.h" #include "stdio.h" #include "conody" main () {char C, Theta Array [20]; INT A, B, T, I = 0, J = 0; SQSTACK OPTR; SQSTACK2 OPND; CLRSCR (); Main () {Char C, Theta, Array [20]; Int A, B, T, I = 0, J = 0; SQSTACK OPTR; SQSTACK2 OPND; CLRSCR (); InitStack (& Optr); Push (& Optr, '#'); INITSTACK2 (& OPND); Gets (array); While (Array [i] ) i ; initstract; push (& optr, '#'); initstack2 (& opnd); gets (array); while (Array [i]) i ; if (Array [i-1]! = '=') Printf ("You Must Put !!"); Else {i = 0; While (Array [i]! = '=' || gettop (optr)! = '#') { While (in (array [i])) {i ; j ;} if (j) {t = atoi (& array [ij]); push2 (& opnd, t); j = 0;} if (! in (array " I])) {switch (precede (gettop (optr), array [i])) {case '<': push (& optr, array [i]); i ; Break; Case '=': POP (& Optr, & C ); i ; break; case '>': POP (& optr, & ipta); POP2 (& Opnd, & a); PUSH2 (& Opnd, Operate (A, Theta, b)) Break; Default: Printf ("Warning: Data Error!");} / * Switch * /} / * if * /} / * Swices * /} / * else * / printf ("% d", gettop2 (OPND) )); SLEEP (2);} / * main * / if (Array [i-1]! = '=
|| a == '-' || a == '*' || a == '/' || a == ')') && (b == ' ' || b == '-' | | b == ')' || b == '=') || (((a == '*' || a == '/') && (b == '*' || b == ' / ')) Return'> '; Else Return' @ '; Precede (Char A, Char B) {IF (((A ==') && (B == ')')) || (((((( A == '#') && (b == '='))) Return '='; ELSE IF (((a == '(' || a == '#') && (b == ' '|| B ==' - '|| b ==' * '|| b ==' / '|| b ==' (')) || ((A ==' '|| a == '-') && (b == '*' || b == '/' || || ((a == '*' || a == '/') && B == '(')) Return '<'; ELSE IF ((A == ' ' || a == '-' || a == '*' || A == '/' || a == ')') && (b == ' ' || b == '-' || b == ')' || b == '=') || (((a == '*' || a == '/') && (b == '*' || b == '/'))) Return '>'; else return '@';}} int operate (int A, char @ INT b) {Int T; switch (Theta) {case ' ': t = (a b); Break; Case '-': t = (ba); break; cas '*': t = (a * b); Break; Case '/': t = (b / a); break;}; return t;} int in (char c) {if (c> = '0' && c <= '9'