The task is to complete this program so that
the expression in expressionString is evaluated and the integer which
is the result of the evaluation is printed. I will discuss the problem
in full detail in class on Feb 3, along with the stack based approach that
you should implement. I will also post some more information here later,
but this will not cover the entire discussion. I will answer questions
about the homework in class on Feb 5 and 8, so in case you missed the
discussion on Feb 3, you can catch up.
Posted on Feb 8: Roughly speaking, one algorithm for evaluating
the expression is as follows. Scan the character array cArray, which
is obtained from expressionString, from left to right. Whenever you
see a `(', ignore it. When you see a `*' or `+' or a numberical character,
push onto stack. When you see a `)', pop the top three things in the
stack, evaluate, and push the result onto the stack.
The sole number that is left in the stack after cArray was been scanned
is the result we want to print.