数据结构实验——中缀表达式向后缀表达式的转化(包括四则运算和幂运算)——详细注释(Conversion of data structure experiment infix expression to suffix expression (including the four operations and exponentiation), detailed notes).docVIP
- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
数据结构实验——中缀表达式向后缀表达式的转化(包括四则运算和幂运算)——详细注释(Conversion of data structure experiment infix expression to suffix expression (including the four operations and exponentiation), detailed notes) # includes stdio.h # includes stdlib.h / * 输入输出说明: 输入. 输入一中缀表达式并紧接符号 # 以结束输入. 输入样例如下. a + b + c + d + e + f) * g # c * a + b * d - (e + f * g) * h # a * (b + c) / (d + e + f) + (g) - (h # 输入注意, 括号一律用圆括号 输出. 输出相应后缀表达式. 输出样例如下. abc * + de * f + g * + ca * bd * + * + h * - efg abcde + f + / + g + * h # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 带幂运算的优先级顺序 (左低右高) +, +, - +, -, 注意. 加减具有同一优先级. 乘除具有同一优先级. 且幂运算 ^ 与乘法运算 * 的优先级顺序不具有可比性! ! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 样例输入: 3 * 6 ^ 5 * 2 # 3 * 2 ^ 3 ^ 2 ^ 2 ^ 3 + 2 * 5 - 5 # 6 + 3 * 2 ^ 3 * 2 ^ 2 ^ 3 + 4 + 5 # 样例输出: 3652 * ^ * 323223 ^ ^ ^ ^ *? 5 * + 5 -* ^ ^ * ^ * + 5 + 注意: 第二组数据输出中的 ? 本该是 2. 经过长时间测试及数据对比, 至今仍未找到确切原因. 故尚且属于未知错误, 作特殊情况处理! ! * / struct hi { char ch; hi * next; }; hi * plus _ pettigrew (hi * tempstack) { while (tempstack! = = null) { if (tempstack - ch = = 1 / / 如果遇到左括号就返回 空 { return null; / / 因为说明要输入的元素本身就包含在一组括号中 } else if (tempstack - ch = = + | | tempstack - ch = = -) { return tempstack; } tempstack = tempstack - next; } return null; / / 没有找到优先级更高的则返回 空 } hi * hap _ div (hi * tempstack) { while (tempstack! = = null) { if (tempstack - ch = = (| | tempstack - ch = = 2) { return null; } else if (tempstack - ch = = * | | tempstack - ch = = /) { return tempstack; } tempstack = tempstack - next; } return null; } hi power (hi * * tempstack, hi * temptail) { while (tempstack! = = null) { if (tempstack - ch = = () { return null; } else if (tempstack - ch = = 6) / / 如果有幂运算就全部弹出 { return temptail; / / 所以返回尾部地址 } tempstack = tempstack - next; } return null; } the * sign (hi * tempstack) { while (tempstack! = = null) { if (tempstack - ch = = () { return tempstack; } tempstack = tempstack -下; } 返回null; } 国际main
您可能关注的文档
- 6.1 模板(6.1 templates).doc
- 06全口带入及问题(06 full mouth intake and problems).doc
- 6aunit3第一课时(6aunit3 first class).doc
- 6级英语单词p(6 English words p).doc
- 7 给水排水(7 water supply and drainage).doc
- 7 地形图测绘(7 topographic mapping).doc
- 7.4《流体压强与流速的关系》说课稿(7.4 the relation between fluid pressure and velocity).doc
- 7.3使用燃料对环境的影响(7.3 environmental impact of the use of fuel).doc
- 7a单词(7A word).doc
- 7侧翼理论(7 flank theory).doc
- 数据结构算法演示(Windows版)(Data structure algorithm demonstration (Windows version)).doc
- 数据结构题目(Data structure title).doc
- 数据结构实验一答案(Data structure experiment one answer).doc
- 数据结构图的建立与计算(Establishment and calculation of data structure diagram).doc
- 数据结构习题与答案(Data structure exercises and answers).doc
- 数据结构-停车场程序(Data structure - parking procedures).doc
- 数据结构与算法常用英语词汇(Data structures and algorithms commonly used in English Vocabulary).doc
- 数据结构与网络游戏(Data structures and online games).doc
- 数据结构中串的各种算法(Data structure string of various algorithms).doc
- 数据流程与业务流程的区别(The difference between a data process and a business process).doc
文档评论(0)