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