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.

16 234.465 # one operand # this one is empty 3 0 / # divide by 0 3 4 5 + # too many operands 3 4 + + # too 

For the P1.in example given above, your program should exactly generate the following output:

Expression 1: 234.465 The value is: 234.465 The Intermediate Results are: Expression 2: Invalid Expression 

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

#include #include  

Queue.cpp #include  

RPNEval.cpp

#include  

Stack.cpp #include  

RPNEval.h

#pragma once #ifndef __RPNEVAL_H #define _RPNEVAL_H #include  11- ----- void PrintIntermediateResults(); private: bool valid; // Is RPN expression valid? OperandType 

Queue.h #pragma once #include using namespace std; typedef float QueueType; const int TOTAL_QUEUE = 100; 

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

1 Expert Approved Answer
Step: 1 Unlock

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

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