Assignment, Sep 21:
Assignment P6:
Write a program which reads lines from stdin, using scanf(). Each line will consist of a single operator character, followed by some spaces, and 2 integers. For each line read, until end-of-file, your program should read the line, and print a line consisting of (a) the operator name, (b) the numbers read, (c) = , and (d) the result of the operation. The operator characters are : +, -, *, and /. If the line is
- 1234 234
the answer should be:
- 1234 234 = 1000
Thus, the expression your program should evaluate is obtained by putting the operator character between the two integers on the same line. If an illegal operator character occurs, print the offending character in an understandable error message, and terminate the program.