LAB 8: A calculator program for postfix expressions

DUE MON April 21, 2pm

You will write a program which takes an expression from the user in postfix notation and prints out its value.

Requirements:

Use the stack class provided by file stack2.h (available in class folder, inside the folder Chapter 7). Do NOT use STL stack class. (The stack class provided uses linked list implementation. The necessary node template class is also provided in node2.h)

Your program should ignore all the characters which are not numbers or one of the operations symbols: + - * /

Assume that all the operations are binary operations.


Your program should give an appropriate message for possible errors. The possible errors are: (a) division by zero, (b) an operation symbol is read but the stack does not have at least two numbers, (c) the entire expression has been read and evaluated but the numbers stack does not have exactly one number on it