CPTR-142 Homework #2 - Due Friday 4/04/14
Finish reading section 1.2 from the textbook if needed. Pay
particular attention to the descriptions of writing algorithms
and the examples of unstructured and structured algorithms
on pages 15 & 16.
Then read section 1.3 regarding coding. Figures 1.9 to 1.12 give
an example of C++ coding that is useful but pay particular
attention starting with page 24 to the guidelines regarding
good programming habits.
For programming assignment 2 create a program that will read in
5 integers (scores), determine the value of the largest score,
and print a list of the 5 scores and, for each, the difference between
it and the largest score. Below is a sample dialogue (i.e. printout)
as the program is used:
Enter 5 scores:
5 9 2 10 6
The highest score is 10
The scores and their
differences from the highest are:
5 off by 5
9 off by 1
2 off by 8
10 off by 0
6 off by 4
Before coding the program create an outline of your program (i.e.
your algorithm in the language of text section 1.2). Try putting
it into structured form like the example on page 16. This outline
can be hand written if you wish.
This program is basically further review of programming using the
cin and cout routines and does not require creation of classes or
objects.
Only a printout of your program (main.cpp) needs to be turned in at class
time for this assignment. But, you need to write a note at the
bottom of your printout stating if you were able to compile and
run it and if proper operation was observed. Also, note that printouts
should be folded and on the outside must be: CPTR-142 program 2,
name, and date.
Larry Aamodt PhD, PE
Professor of Engineering and Computer Science
Walla Walla University
Contact:
via email: AamoLa (at) wallawalla.edu
via phone: x2058