文件名称:compute
介绍说明--下载内容均来自于网络,请自行研究使用
表达式求值:给定一个浮点数混合运算的中缀表达式,分别实现:转换成为后缀表达式,然后求值;直接对中缀表达式求值两种求值算法两种实现方法。表达式中包含的运算符:加法+,减法-,乘法*,除法/,括号(),乘方#等运算符。运算符的优先级和结合性符合数学运算法则。比如:命令行输入 (-2.0)+(1.0+2.0)*3.0-2.0#2.0回车
(1)中缀表达式输出:
(-2.0)+ (1.0+2.0)*3.0-2.0#2.0=3.0
(2)后缀表达式输出:
-2.0 1.0 2.0 + 3.0 * + 2.0 2.0 # -
(-2.0)+ (1.0+2.0)*3.0-2.0#2.0=3.0-Expression evaluation: in infix expression to a floating point number to the mix operator, respectively, to achieve: convert postfix expression and then evaluated infix expression evaluation are two evaluation algorithms implemented in two methods. The expression contains operators: addition+, subtraction-, multiplication*, division /, parentheses (), involution#, and other operators. Operator precedence and associativity of the mathematical algorithm. For example: the command-line input (-2.0)+ (1.0+2.0)* 3.0-2.0# 2.0 Enter
(1) infix expression output:
(-2.0)+ (1.0+2.0)* 3.0-2.0# 2.0 = 3.0
(2) postfix expression output:
-2.0 1.0 2.0+ 3.0*+ 2.0 2.0-
(-2.0)+ (1.0+2.0)* 3.0-2.0# 2.0 = 3.0
(1)中缀表达式输出:
(-2.0)+ (1.0+2.0)*3.0-2.0#2.0=3.0
(2)后缀表达式输出:
-2.0 1.0 2.0 + 3.0 * + 2.0 2.0 # -
(-2.0)+ (1.0+2.0)*3.0-2.0#2.0=3.0-Expression evaluation: in infix expression to a floating point number to the mix operator, respectively, to achieve: convert postfix expression and then evaluated infix expression evaluation are two evaluation algorithms implemented in two methods. The expression contains operators: addition+, subtraction-, multiplication*, division /, parentheses (), involution#, and other operators. Operator precedence and associativity of the mathematical algorithm. For example: the command-line input (-2.0)+ (1.0+2.0)* 3.0-2.0# 2.0 Enter
(1) infix expression output:
(-2.0)+ (1.0+2.0)* 3.0-2.0# 2.0 = 3.0
(2) postfix expression output:
-2.0 1.0 2.0+ 3.0*+ 2.0 2.0-
(-2.0)+ (1.0+2.0)* 3.0-2.0# 2.0 = 3.0
(系统自动生成,下载前可以参看下载内容)
下载文件列表
compute.cpp
functions.h
main.cpp
Stack.h
functions.h
main.cpp
Stack.h