资源预览内容
第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
亲,该文档总共5页全部预览完了,如果喜欢就下载吧!
资源描述
#include #include #define MaxSize 100#define MaxOp 7typedef structchar dataMaxSize;/存放运算符int top;/栈指针 zhifu;/定义运算符栈typedef structfloat dataMaxSize;int top;num;int InOp(char ch) /判断ch是否为运算符if (ch=( | ch=) | ch=+ | ch=- | ch=* | ch=/|ch=)return 1;elsereturn 0;char Precede(char c1,char c2) int i=0,j=0; static char array49= , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , !, , , , , , , =0 & *exp=9) /判定为数字d=10*d+*exp-0;exp+;st.top+;st.datast.top=d;else/为运算符的情况switch(Precede(op.dataop.top,*exp) case : /退栈并输出到postexp中compvalue(op,st);op.top-;break; printf(%fn,st.datast.top);void main()char exp=(56-20)/6-8+9=;trans(exp);
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号