CSC 270

Homework 1
assigned 12 Sept, due 1 Oct

Write a program in C to do simple arithmetic interactively. The user will type an operator (+, -, or *), then two integers separated by spaces. The program will print out the answer in a suitably informative format. Example:

panther% hw1
+ 15 4
15 + 4 = 19
panther% hw1
- 8 19
8 - 19 = -11
panther% hw1
* 6 -3
6 * -3 = -18
panther%

Grading: Most important is whether the program works.

The user interface is also important. It should be easy to use, yet not get in the way. Output should be clear and readable, but not too verbose. Errors should be handled gracefully and informatively, not by crashing, going into infinite loops, or printing incorrect answers.

I'll also give a good deal of weight to programming style, including the following points:

Things you can add for extra credit:

I recommend that you develop this program in stages. First write a very simple program that does only a small part of the assignment. Get it working. Then modify it so it does a little more of what you want it to. Get this working. And so on until it does everything you want it to do, with all the extra credit features, or until the assignment is due, whichever comes first.


Last modified: Wed Sep 11 14:58:26 EDT 1996
Stephen Bloch / sbloch@boethius.adelphi.edu