Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers. [Basic Requirements] 1) You are required to use stack. 2) The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value. If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter.
Expression Conversion
[Problem Description]
Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers.
[Basic Requirements]
1) You are required to use stack.
2) The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value.
If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter.
Please i need the above topic program in C or C++
Step by step
Solved in 2 steps with 1 images