Question: This is C++ code to Evaluate RPN expressions using a stack, store intermediate results in a queue, and use input files to simulate user input
This is C++ code to Evaluate RPN expressions using a stack, store intermediate results in a queue, and use input files to simulate user input in your program. I need help to complete the code listed below.
Below is the input file, P1.in.
For the P1.in example given above, your program should exactly generate the following output:
The output for each RPN expression is comprised of four lines of output, as follows:
• expression number
• expression with one space after each operand or operator
• value of the expression or a message if it is invalid
• intermediate results, with one space after each
Must have the following files:
• Stack.h
• Stack.cpp
• Queue.h
• Queue.cpp
• RPNEval.h
• RPNeval.cpp
• Prog1.cpp
Code that needs to be updated:
Prog1.cpp
RPNEval.cpp
RPNEval.h
16 234.465 # one operand # this one is empty 3 0 / # divide by 0 3 4 5 + # too many operands 3 4 + + # too many operators + # no operands to pop 3 4 + 7 7 / # another divide by 0 3 4 5 + B + #bad character 2 3 4 + # 2.1 2.55 + 23.4* # 12.6 11.4 * *+2 + 19.4 18.3 5 12 4/8 * 2 9 11 / 64 # 3 4 5 6 + * # 2 3 4 - + 7 * 8 9 # 2 / # # this one is empty also * 5 + 6 7 + + - - - - + # 2 3 4 5 -
Step by Step Solution
There are 3 Steps involved in it
It seems like youre looking to complete a C program which can evaluate Reverse Polish Notation RPN expressions using a stack to hold operands and a qu... View full answer
Get step-by-step solutions from verified subject matter experts
