首页 开发技术 C     /    数据结构课程设计表达式类型的实现(包含测试数据和课程设计报告)完美版

数据结构课程设计表达式类型的实现(包含测试数据和课程设计报告)完美版

上传者: fangruizhou | 上传时间:2024/7/18 11:15:53 | 文件大小:273KB | 文件类型:rar
数据结构课程设计表达式类型的实现(包含测试数据和课程设计报告)完美版
【问题的描述】一个表达式和一棵二叉树之间,存在着自然的对应关系。
写一个程序,实现基于二叉树表示的算术表达式Expression的操作。
【基本要求】【一】【必做部分】假设算术表达式Expression内可以含有变量(a-z),常量(0-9)和二元运算符(+,-,*,/,^(乘幂))。
实现以下操作:(1)ReadExpr(E)――以字符序列的形式输入语法正确的前缀表达式并构造表达式E。
(2)WriteExpr(E)――用带括号的中缀表达式输出表达式E。
(3)Assign(V,c)――实现对变量V的赋值(V=c),变量的初值为0。
(4)Value(E)――对算术表达式E求值。
(5)CompoundExpr(p,E1,E2)――构造一个新的复合表达式(E1)p(E2)。
【二】【选做部分】(1)以表达式的原书写形式输入,支持大于0的正整数常量;
(2)增加常数合并操作MergeConst(E)——合并表达式E中所有常数运算。
例如,对表达式E=(2+3-a)*(b+3*4)进行合并常数的操作后,求得E=(5-a)*(b+12)【测试数据】1) 分别输入0;
a;-91;+a*bc;+*5x2*8x;+++*3^*2^x2x6并输出。
2) 每当输入一个表达式后,对其中的变量赋值,然后对表达式求值。
3) 还有很多测试的数据,详细请见附上的文件Test.txt。

文件下载

资源详情

[{"title":"(35个子文件273KB)数据结构课程设计表达式类型的实现(包含测试数据和课程设计报告)完美版","children":[{"title":"数据结构课程设计-表达式类型的实现","children":[{"title":"测试","children":[{"title":"测试数据.txt <span style='color:#111;'>1.62KB</span>","children":null,"spread":false},{"title":"部分测试的截图","children":[{"title":"合并常数操作1.bmp <span style='color:#111;'>422.55KB</span>","children":null,"spread":false},{"title":"测试求算数表达式的值带有变量.bmp <span style='color:#111;'>104.72KB</span>","children":null,"spread":false},{"title":"测试构造复合表达式1.bmp <span style='color:#111;'>302.55KB</span>","children":null,"spread":false},{"title":"测试构造复合表达式3.bmp <span style='color:#111;'>550.05KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入常量.bmp <span style='color:#111;'>548.41KB</span>","children":null,"spread":false},{"title":"测试原表达式输入出错处理2.bmp <span style='color:#111;'>152.55KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入变量.bmp <span style='color:#111;'>224.70KB</span>","children":null,"spread":false},{"title":"测试赋值操作1.bmp <span style='color:#111;'>252.16KB</span>","children":null,"spread":false},{"title":"测试原表达式输入出错处理4.bmp <span style='color:#111;'>155.54KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入错误前缀表达式2.bmp <span style='color:#111;'>140.05KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入较为复杂表达式.bmp <span style='color:#111;'>187.26KB</span>","children":null,"spread":false},{"title":"测试赋值操作3.bmp <span style='color:#111;'>222.21KB</span>","children":null,"spread":false},{"title":"测试求算数表达式的值1.bmp <span style='color:#111;'>304.58KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入-91.bmp <span style='color:#111;'>184.76KB</span>","children":null,"spread":false},{"title":"主菜单界面.bmp <span style='color:#111;'>639.54KB</span>","children":null,"spread":false},{"title":"Thumbs.db <span style='color:#111;'>37.50KB</span>","children":null,"spread":false},{"title":"测试求算数表达式的值2.bmp <span style='color:#111;'>102.55KB</span>","children":null,"spread":false},{"title":"测试原表达式输入BUG1.bmp <span style='color:#111;'>190.05KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入错误前缀表达式1.bmp <span style='color:#111;'>139.83KB</span>","children":null,"spread":false},{"title":"合并常数操作多次合并2.bmp <span style='color:#111;'>97.86KB</span>","children":null,"spread":false},{"title":"测试构造复合表达式2.bmp <span style='color:#111;'>280.05KB</span>","children":null,"spread":false},{"title":"合并常数操作多次合并3.bmp <span style='color:#111;'>94.76KB</span>","children":null,"spread":false},{"title":"测试前缀表达式输入输出带括弧.bmp <span style='color:#111;'>175.33KB</span>","children":null,"spread":false},{"title":"测试原表达式输入出错处理3.bmp <span style='color:#111;'>155.05KB</span>","children":null,"spread":false},{"title":"测试原表达式输入出错处理1.bmp <span style='color:#111;'>152.31KB</span>","children":null,"spread":false},{"title":"测试赋值操作2.bmp <span style='color:#111;'>255.05KB</span>","children":null,"spread":false},{"title":"合并常数操作多次合并1.bmp <span style='color:#111;'>97.25KB</span>","children":null,"spread":false},{"title":"测试原表达式输入简化括弧.bmp <span style='color:#111;'>172.55KB</span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"课程设计报告-表达式类型的实现-方锐洲.doc <span style='color:#111;'>279.50KB</span>","children":null,"spread":false},{"title":"源代码和可执行文件","children":[{"title":"expression.exe <span style='color:#111;'>212.10KB</span>","children":null,"spread":false},{"title":"expression.h <span style='color:#111;'>3.84KB</span>","children":null,"spread":false},{"title":"expression.c <span style='color:#111;'>18.30KB</span>","children":null,"spread":false}],"spread":true},{"title":"表达式建二叉树示例.bmp <span style='color:#111;'>1.59MB</span>","children":null,"spread":false},{"title":"Thumbs.db <span style='color:#111;'>4.50KB</span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • 不负遇见:
    对我的帮助很大,很是喜欢。。2015-07-24
  • libaotian1:
    内容很详细,对我很有用。虽然10个积分贵了点,但还是挺有用的2015-05-20
  • yangjing1213:
    结构划分的很详细,稍微修改即可使用,注释很很给力!.2013-09-15
  • 愚公搬代码:
    内容挺详细的,但是需要10个资源分,有点多!2013-06-23
  • xingchenwuliao:
    内容挺详细的,稍加修改就能用了,但是需要10个资源分,有点多!当时下的时候才刚注册不久,不知道10个积分挺难赚的,有点心疼哈2013-03-06

免责申明

【好快吧下载】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【好快吧下载】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【好快吧下载】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,8686821#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明