Menu

(Solved) : Write Stack Application Program Evaluate Post Fix Expressions Using C Language Must Cpp H Q37250428 . . .

Write a stack application program to evaluate post-fixexpressions using the C++ language

Must be have .cpp and . h files ( 3 files total)

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 numbersonly. 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 theend)

Your program will display the evaluated result (a number) or anerror message describing what is wrong (the algorithm is inNotes-1, so use it as given).

• You may assume that no expression will be longer than 12characters.

• Since each element of the string is a character, you will needto 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+ incomplete expression

NOTE: Do you think I have listed all possible cases? Always askyourself if there are other cases you should test to make sure yourprogram is bug free.

Expert Answer


Answer to Write a stack application program to evaluate post-fix expressions using the C++ language Must be have .cpp and . h file…

OR