Question: Using C + + . For this assignment, you are to write a program, which will calculate the results of Reverse Polish expressions that are

Using C++.For this assignment, you are to write a program, which will calculate the results of Reverse Polish expressions that are provided by the user. And Use Good self documenting / commented code.
You must use a single linked list to maintain the stack for this program (array implementations of the stack will not receive full credit).
You must handle the following situations (errors):
Too many operators (+-/*)
Too many operands (doubles)
Division by zero
The program will take in a Polish expression that separates the operators and operands by a single space, and terminates the expression with an equals sign.
The program will continue to take and evaluate expressions until the user enters a zero (0) on a line by itself followed by a new line.
Your sample output should show the handling of all the error conditions as well as make use of all of the operators.
Sample IO: (note: formatting of output isnt a critical issue)
Input Output
1015+=25
1015-=-5
2.53.5+=6(or 6.0)
100/= Error: Division by zero
1020*/= Error: Too many operators
122030/= Error: Too many operands
-10-30-=20
100105025/*--2/=-40

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