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 #include using namespace std;

/// 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!