You are to implement a c++ program that converts an infix expression into a post
ID: 646802 • Letter: Y
Question
You are to implement a c++ program that converts an infix expression into a postfix expression and then evaluate the postfix expression.
Output:
Print out the infix expression, the postfix expression and the calculated results of the expression.
You are to handle the (), + - * / and ^ (exponential/power) operators. The ^ operator precedence is higher than * and / operators.
Turn in to me the program and the resulting output.
To test your program, use the following input expressions. Put the input data into a file to be read in. Test your program with some simple expressions before using the data below and make sure each of your operations work correctly.
5 + 7
6 ^ 2 + 1
3 * 8 + 6
5 ^ 4 - 6 ^ 4
5 - 3 * 7 / 4 - 9
8 * ( 9 / 3 - 2 ) / 4 + 5 * 6
5 ^ 3 * 4 + ( 2 + ( 9 * 8 / ( 2 * 6 * ( 8 / 4 ) ) ) ^ 2 * 8 - 5 ) / 5 ^ 2 - 4
5 - 3 * 8 / 2 ^ 3
3 ^ 3 ^ 2 *3
8 * ( 6 / 3 - 2 ) / 4 + 5 * 6 +3
Explanation / Answer
# include # include # include # include int top=-1; char Stack[100]={NULL}; void push(constchar); constchar pop( ); void infix_to_postfix(constchar *); int main( ) { clrscr( ); char Infix_expression[100]={NULL}; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.