[问题] 运算式 infix 转 prefix

楼主: OSDBNetwork (路人甲)   2015-12-16 04:02:29
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
GCC
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)

问题(Question):
书本的程式
无法执行
喂入的资料(Input):
4*(5+6)
预期的正确结果(Expected Output):
*4+56
错误结果(Wrong Output):
一堆乱码
程式码(Code):(请善用置底文网页, 记得排版)
https://repl.it/B8j7/0
补充说明(Supplement):
书本的 infix 转 postfix 程式码 正确,
但是 infix 转 prefix 程式码 有问题.
请问各位大大,该怎么改程式码呢?
感恩
作者: Qbsuran (Qbsuran)   2015-12-16 18:25:00
从后面判断回来 ()颠倒 最后再整个反转
楼主: OSDBNetwork (路人甲)   2015-12-16 20:30:00
谢谢Q大,改好了! https://repl.it/B8j7/1// expression[0]='\0';有些是自己打错~case '(': while(stack[top]!=')')case ')': while(InStackPriority(stack[top])...case ')': return 1;case '(':

Links booklink

Contact Us: admin [ a t ] ucptt.com