This paragraph gives the motivation for providing this particular assignment.

What to hand in:

This section is intended to detail specifics of what is expected to be handed in for this assignment. In general, you will be asked to hand in code listings, output from sample runs of the application, and answers to questions.


This paragraph provides the textual description of the problems to be considered for this assignment. Follow instructions carefully!

Some of the problems may be optional; these are marked with Optional: at the beginning of the paragraph. Please do not attempt any optional parts until you have successfully completed the rest of the assignment. Optional parts learning opportunities for the motivated; optional parts are marked, but not scored for or against a student.


This section contains hints, suggestions, clarifications, and other miscellany associated with the problems. You should scan this section before attacking the problems.

Evaluation criteria:

This section gives the relative weights of the various portions of the homework problems.

All homework exercises are weighed with regard to 3 basic categories:



Approaching the same kinds of constructs (if, for, etc.) the same way throughout the code


Homework provided in complete, reviewable order

Appropriate commenting-top comment block, unusual constructs

Appropriate indentation-consistency, 2-6 spaces per level

Print not faded or dropped out, no printing beyond page borders, etc.


Meeting Requirements

Ensuring that goals of the problem are achieved

Adhering to interfaces specified in the problem

Consistent policies

Consistent policies for error conditions, input and output models, etc.

A common error handling policy is to print a useful message and exit; another is to clear the input and let the user try again

A common I/O policy is to read a line at a time from the standard input, and then process it. A bad policy is to sometimes read a value (e.g., scanf() or >>) and sometimes read a line (e.g., fgets())


Appropriate use of language constructs

Use switch statements for fixed, integral cases; if/else for alternatives that cannot be pre-computed; for and while when iterating

Avoid mixing I/O libraries (iostreams vs. stdio)

Robustness of code

Check for common error conditions, including end-of-file or bad input


Use a direct, clear mechanism to achieve the desired result


This may be a minor issue on your job, but portability limitations will be marked on your homeworks to raise your consciousness about them. In general, use standard C++ constructs where they exist, and be careful to annotate where you are using OS-specific functions or headers.

Sample Runs and Test Code

Always hand in output, even if it is just your compiler error listings

Use your tests to thoroughly test the interfaces; normal and boundary conditions