Logic:-
This program makes use of the stack. A stack is used to store elements in LIFO order. The element which comes at the end is deleted first. You can imagine that MS Word uses a stack to store operation in a specific order. When we perform ‘undo’ then it deletes the last operation performed.
This program takes a string of an infix expression and gives a string of postfix operation. It simply considers the every character of the infix string and if the character being considered is a number then it is appended to the postfix string. If it is a symbol then it is pushed onto the stack. Rest of the process is quite simple. The code is also self-explanatory.
Output:
----------------------------------------------
| |
| INFIX TO POSTFIX EXPRESSION CONVERTER |
| |
----------------------------------------------
INFIX EXPRESSION = 1+2*3
POSTFIX EXPRESSION = 123*+
need an explanation for this answer? contact us directly to get an explanation for this answer