I’m writing calculator that calculates values from expressions:
3+(23/24)*34/24
I used RPN algorithm: https://en.wikipedia.org/wiki/Reverse_Polish_notation
I have now sorted expression in String:
3 23 24 / 34 * 24 / +
I don't have any idea how can I get value from this expression.
Thx
The basic algorithm is based on a stack-like structure
For each token in the expression:
E.g.:
The last value that remains in the stack is the result