Does anyone know how to do this?
You are to write a program that evaluates simple arithmetic expressions which are composed by positive numbers (real or integers) and the four basic arithmetic operators: +, -, * and /. The program will have to adhere to the following rules:
The expressions will be evaluated left to right (all operators will have the same precedence).
Blank spaces are ignored.
The expression is terminated by the end of the line, at which point you will display the answer.
The prompt is indicated with >.
You have to guard against illegal characters entered.
The program can be terminated only by pressing <CTRL-C>.
Ex:
> 2 + 3 * 4/6
3.333333
> 2/4+3
3.500000
> 2!/4+3
*** Illegal character !
>