Assignment 6 ============== T.A : Fan Mail to : HCAF on MUSICB (all other destinations will be IGNORED) Send your 'C' source file, your data and output to your code HC-- on MUSICB. Then E-Mail both to HCAF To get credit for your assignments they MUST by mailed from your own HC-- code - that's how we keep track of all the students in the class. Due : 30 November 1997 Weight : 35Assignment 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 is 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