Question
Your task in this week is to convert an infix expression to postfix expression. See the code template and sample output given billow for a
Your task in this week is to convert an infix expression to postfix expression. See the code template and sample output given billow for a clear understanding. Also, write a function to evaluate a postfix expression. Please do Comment the steps for understanding. Thanks.
Code template: #include
/// implement your 'stack' here
int main() { Stack s; string infix, postfix[100];
cout << "\t\tInfix to Postfix Converter v1.0 "; cout << "\t\t=============================== ";
cout << "Enter an infix expression: "; getline(cin, infix);
infix += " )"; s.push("(");
istringstream token(infix); string t, p; int i=0, j;
while(token>>t) { /// You have got the input symbol 't'. /// Now you have to process all the input symbols and /// fill in the 'postfix' array accordingly. }
cout << endl << "The equivalent postfix expression is: "; for(j=0; j
return 0; }
Sample output: Infix to Postfix Converter v1.0 =============================== Enter an infix expression:A + ( B * C - ( D / E ^ F ) * G ) * H The equivalent postfix expression is: A B C * D E F ^ / G * - H * + Process returned 0 (0x0)execution time : 11.891 s Press any key to continue.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started