Program 2

Due: Monday March 4, 2002, email by midnight.

This programming assignment 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.0)*4 + 5/6.1
your program should first output the postfix:
2.0 3.0 -  4.0 *  5.0 6.1 / +
and then output the result of evaluating it:
postfix evaluation = -3.1803
Your infix expression could contain integers or decimal expressions. All
operands should be converted to floats before evaluation, for this assignment.  You should write your own parser, and not use the string tokenizer methods.

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.