# 表达式解析前缀表达式再计算表达式的值，这个用C语言来实现的方式？

Problem Description
Reverse Polish notation (RPN) is a method for representing expressions in which the operator symbol is placed after the arguments being operated on.
Polish notation, in which the operator comes before the operands, was invented in the 1920s by the Polish mathematician Jan Lucasiewicz.
In the late 1950s, Australian philosopher and computer scientist Charles L. Hamblin suggested placing the operator after the operands and hence created reverse polish notation.

RPN has the property that brackets are not required to represent the order of evaluation or grouping of the terms.
RPN expressions are simply evaluated from left to right and this greatly simplifies the computation of the expression within computer programs.
As an example, the arithmetic expression (3+4)*5 can be expressed in RPN as 3 4 + 5 *.

Reverse Polish notation, also known as postfix notation, contrasts with the infix notation of standard arithmetic expressions in which the operator symbol appears between the operands. So Polish notation just as prefix notation.

Now, give you a string of standard arithmetic expressions, please tell me the Polish notation and the value of expressions.

Input
There're have multi-case. Every case put in one line, the expressions just contain some positive integers(all less than 100, the number of integers less than 20), bi-operand operators(only have 3 kinds : +,-,*) and some brackets'(',')'.
you can assume the expressions was valid.

Output
Each case output the Polish notation in first line, and the result of expressions was output in second line.
all of the answers are no any spaces and blank line.the answer will be not exceed the 64-signed integer.

Sample Input
1+2-3*(4-5)
1+2*(3-4)-5*6

Sample Output
Case 1:

• + 1 2 * 3 - 4 5 6 Case 2:
• + 1 * 2 - 3 4 * 5 6 -31
• 写回答

#### 1条回答默认 最新

• threenewbee 2020-01-07 01:28
关注
本回答被题主选为最佳回答 , 对您是否有帮助呢?
评论

#### 悬赏问题

• ¥15 调用函数时，无关变量的改变引起函数值的改变
• ¥15 xy坐标转化为经纬度坐标
• ¥15 一般三角模糊数的上界值和下届值取中值的多少比较合理？
• ¥15 关于#python#的问题，请各位专家解答！
• ¥20 Hbase启动失败，无法启动HMaster
• ¥15 sqpingboot在父模块已经引入了mybatisplus 在子组件不写版本号还是报错
• ¥20 Lumerical FDTD solutions 中模型的相对阻抗，有效介电常数和有效磁导率的实部和虚部的数据如何获得？
• ¥100 sql reporting service 远程smtp服务器配置支持
• ¥15 ppyoloe_r带角度目标检测，loss_cls没法收敛
• ¥15 淘宝交易指数如何解读，其关联的数据指标是什么