Program 2

Due: Feb. 20, 2001, 11AM by email

This programming assingment will illustrate the use of the stacks in two ways. First, your program should take an input string that is an infix expression, and convert it to postfix. Second, your program should take a postfix expression and evaluate it.

For example, if you input the infix string:

2 - 3*4 + 5/6
your program should first output the postfix:
2 3 4 * - 5 6 / +
and then output the result of evaluating it:
postfix evaluation = -9.16667
For extra credit, your infix expression could contain more complicated operands than single digits (for example, multidigit integers, or decimal expressions). Other extra credit options include adding unary operators to the mix (negative number operands, or exponentiation for example). Talk to me if you have other ideas for extra credit as well.