Assignment 6
-------------
Write a C program which accepts data lines with simple arithmetic
expressions involving '+','-','*','(' and ')' and evaluates them.
For example:
Input Output
34 + ( 7 - 2 ) * 3 34 + ( 7 - 2 ) * 3 = 49
12 * 4 + ( 21 - 9 ) 12 * 4 + ( 21 - 9 ) = 60
117 + 60 117 + 60 = 177
Instructions:
- Your input is a sequence of lines. Each line represents regular
mathematical expression and consists of the following:
numbers (not more then 4), operators and blanks.
The line starts with a number or left bracket (column 1)
and each number or operator are delimited with a single blank only.
A blank in column 1 indicates end of file.
- A "number" means an unsigned integer constant in standard decimal
notation; that is a sequence of characters,
each of which is one digit (0, 1, 2 ..., 9).
- You do not know the number of characters in advance, hence you cannot
use "C" %d conversion in a format section of a printf.
- Your output should include an input echo, the operands and operators
found and the answer.
- You need not check for illegal input. You need not implement brackets
inside brackets.
Bonus marks for implementing additional features... Additional features
might include:
- Checking for illegal input
- Signed numbers
- Input base other than 10
- Input in Roman numerals (Good Luck!!)
- Input with nested brackets