35,15,+,80,70,-, *,20,///suffix expression
(((35+15) * (80-70))/20) =25//infix expression mode
/,*,+,35,15,-, 80,70,20//prefix expression
The way people think is easy to fix ~~! Just as used to pull 10 into the system. Yes, 2,3,4,8,16.
Wait for the system to be overwhelmed like ~~!
The way people are used to arithmetic is infix expression. And hit the prefix, suffix way: Confused
It's just a way of expressing a formula (not the way you get used to it)
I'm here to teach you a way that maybe your teacher didn't tell you. Simple conversion
An infix-to-Other equation conversion method ~ ~
Here I give an infix expression ~
a+b*c-(D+e)
The first step is to add parentheses to all units of operation by the precedence of the operator ~
The formula becomes Pull: ((A + (B*C))-(d+e))
Step two: Convert prefix and suffix expressions
Prefix: Move the operation symbol before the corresponding parenthesis
It becomes pull:-(+ (A * (BC)) + (DE))
Remove the brackets:-+a*bc+de prefixes appear
Suffix: Move the operation symbol after the corresponding parenthesis
It becomes a pull: ((A (BC) *)-(DE) +)-
Remove the brackets: the abc*-de+-suffix appears
Found no, prefix, suffix is not required to use parentheses to determine the priority.
If you're used to pulling his algorithm. It is calculated from the front of both operands
or find the operator later. Instead of looking in the middle, then you can just mental arithmetic pull.
turn from: http://blog.csdn.net/glldc/article/details/1818787
One infix to other formulas ~ ~