Question: Language: In C++ Requirements:Must comments and following files .cpp and .h files Directions: Write a stack application program to evaluate post-fix expressions. The user will

Language: In C++

Requirements:Must comments and following files .cpp and .h files

Directions: Write a stack application program to evaluate post-fix expressions.

The user will enter a post-fix expression of the form 34+ which means 3+4 345+* which means 3*(4+5) 722+- which means 7-(2+2) as a string. Operators are +, -, and *. Single digit numbers only. No blanks.

Please note that the expression could be wrong. e.g. 3+ too few operands (i.e. cannot pop operand) 345 incomplete expression (i.e. more than the result at the end)

Your program will display the evaluated result (a number) or an error message describing what is wrong. You may assume that no expression will be longer than 12 characters. Since each element of the string is a character, you will need to convert it to an integer to perform arithmetic operations.

Required Test Cases (MUST TEST IN THIS ORDER): 1. 34+ which means 3+4 2. 345+* which means 3*(4+5) 3. 722+- which means 7-(2+2) 4. 34+56++ which means (3+4)+(5+6) 5. 12+34*45+-+ which means (1+2) + ((3*4) - (4+5)) 6. 1234567891234 expression too long 7. + too few operands 8. 3+ too few operands 9. 3# invalid element 10. 2345+

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