Question: C++ Modify your Postfix Calculator to read entries from a file, one line at a time. For those entries that are valid, compute the value
C++
Modify your Postfix Calculator to read entries from a file, one line at a time. For those entries that are valid, compute the value and keep a running total. Display that sum and the number of invalid entries that were in the file.
We will consider a postfix expression to be invalid if:
An operation is encountered, but there are not at least two entries on the stack.
The postfix expression has been consumed, but there is not exactly one entry remaining on the stack.
How many entries in this file were invalid?
What was the sum of the valid postfix expressions in this file?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
