|
What is the mdas rule?
Does it relate to operator precedence?
Your code will have to parse the expression and do the operations in the order of precedence. There are various methods for doing that. A simple one would be to scan the expression for the highest level operation, pick up its operands, do the operation and replace the operands and operation with the results and do it again until there are no operations left to do.
It looks like your code is doing the operations from left to right.
|