I know I am doing this wrong but I could use some help understanding
I know I am doing this wrong but I could use some help understanding
why and some input on how to correct it. Following is what I did but I need three operands and 2 operators.
X= (A+D)*B
ADD X,A,D
MUL X,B,X
The postfix would be AD+B*
The stack would be:
Push A (A onto stack)
Push D (D onto the stack)
Add (Adding A and D)
Push B
Mul (Multiplies result of addition of A and D to B)
Pop X (pops final result off stack)
operands may be alpha or numeric.
Registers A through F may not be changed, i.e. their values are fixed.
Register T may be used as a temporary register, and Register X must contain the final answer.
Showing the postfix for the expression, and then using a stack to evaluate the expression.