Infix expression---postfix expression
From left to right to iterate through the infix expression of each number and symbol, if the number is directly output, that is, as part of the suffix expression, if the symbol is divided into two cases, is the right parenthesis in the stack of left parenthesis (with the left parenthesis) of the elements out of the stack, not the right parenthesis to determine the precedence of the two, if the Then the stack top symbol element, which is not lower than the current symbol priority, is sequentially out of the stack and output, and the current symbol is then put into the stack until the infix expression is traversed.
Suffix expression calculation result
From left to right to iterate through each number and symbol in the expression, encountered the number on the stack, encountered the symbol will be at the top of the stack of two numbers out of the stack, the operation, the results into the stack, until the final results obtained
9 + (3-1) * 3 + 10/2 9 3 1-3 * + 10 2/+