Question: I am tasked to transform infix expressions into postfix expressions. Only prog.cpp is to be changed. I was hinted to add 5 functions to complete

I am tasked to transform infix expressions into postfix expressions. Only prog.cpp is to be changed. I was hinted to add 5 functions to complete this task in prog.cpp under '// your methods...' only. The code should not be limited to handle only these examples. Please explain in detail how you do this.

The following are examples of valid input and output files, along with examples of invalid output files:

Valid input and output:

tp-01.txt => out-01.txt

beginA = Aend=>begin A A = end 

tp-02.txt => out-02.txt

beginA = A;B = Cend=>begin A A = ;B C = end 

tp-03.txt => out-3.txt

beginB = A + C;A = B;C = A - B + C - Aend=>begin B A C + = ;A B = ;C A B - C + A - = end 

Invalid outputs:

ep-01.txt

begin A = B

ep-02.txt

begin A = b end

ep-03.txt

begin A +end

ep-04.txt

beginA = B; end

ep-05.txt

A = B end

Additional information:

The goal here is to transform the infix expressions into postfix expressions.The following are all found in the out-Ox.txt files. Such as: tp-01.txtbegin A = A end Another example: tp-02.txt begin A = A;

The goal here is to transform the infix expressions into postfix expressions. The following are all found in the out-Ox.txt files. Such as: tp-01.txt begin A = A end Another example: tp-02.txt begin A = A; B = C end out-01.txt begin A A = = end out-02.txt begin A A = ; B C = end

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 Algorithms Questions!