全球旧事资料 分类
序较为庞大,调试花费时间较多,主要是在for循环和while循环时容易出错,对于涉及的循环的操作开始和结束条件设置很关键。
五、用户手册
1本程序开发环境为VC60,运行环境为dos操作系统,执行文件为:1exe2运行该程序后产生如下图所示的界面:
专业整理知识分享
f完美WORD格式
3按照提示输入一组表达式。4输入完成后,按回车键。5屏幕上打印出对应于该表达式的后缀表达式。6打印表达式计算结果。
六、测试结果1
2
专业整理知识分享
f完美WORD格式
34
专业整理知识分享
f完美WORD格式
七、附录
源程序文件名清单:
1cpp
主程序
1exe
可执行文件
stdioh
程序中用到的头文件
stdlibh程序中用到的头文件
stri
gh程序中用到的头文件
mathh程序中用到的头文件
程序代码::i
cludestdiohi
cludestdlibhi
cludestri
ghi
cludemathhdefi
eSTACK_INIT_SIZE100defi
eSTACKINCREMENT10defi
eERROR0defi
eOK1栈模块typedefstructSqStack1运算数栈
专业整理知识分享
f完美WORD格式
i
tbasei
ttopi
tstacksizeSqStack1typedefstructSqStack2运算符栈charbasechartopi
tstacksizeSqStack2voidI
tI
itStackSqStack1SSbasei
tmallocSTACK_INIT_SIZEsizeofi
tifSbaseexitERRORStopSbaseSstacksizeSTACK_INIT_SIZEvoidCharI
itStackSqStack2SSbasecharmallocSTACK_INIT_SIZEsizeofcharifSbaseexitERRORStopSbase
专业整理知识分享
f完美WORD格式
SstacksizeSTACK_INIT_SIZEi
tI
tGetTopSqStack1S取栈顶元素
i
teifStopSbase
retur
0eStop1retur
echarCharGetTopSqStack2S取栈顶元素chareifStopSbaseretur
0eStop1retur
ei
tI
tPushSqStack1Si
teStoperetur
OK
专业整理知识分享
f完美WORD格式
i
tCharPushSqStack2Schare
Stoperetur
OK
i
tI
tPopSqStack1S
i
teifStopSbaseretur
0eStopretur
ei
tCharPopSqStack2SchareifStopSbaseretur
0eStopretur
e运算模块
专业整理知识分享
f完美WORD格式
charPrecedecharacharb运算优先级判断
i
tijcharTable88优先级表格fori0i8iifTable0ia纵坐标寻找
breakforj0j8j横坐标寻找ifTablej0b
breakretur
Tablejr
好听全球资料 返回顶部