Hello, (this calculator without operator precedence) the problem is that i want this calculator to output
1+2*3/4=2.25
However, now it output
1+2*3/4=
2.25
it is doing what you told it.
you told it to compute
1+2 (3)
* 3 (9)
/ 4 (2.25)
this is caused by ignoring operator precedence.
The usual way to do this is to use a stack and reverse polish logic. If its a value, push onto the stack, if its an operator, pop the stack twice, do that operation, push result back on the stack. You have to re-order the string into reverse polish first though, which is done with a tree traversal or you can do it with messy logic.
looks like
2,3,* (6)
6,4,/ (1.5)
1.5,1,+ (2.5)
done, 2.5