CprS 157 Schedule
CprS 157 Class 7
CprS 157 Class 9

Repetition Control Structures
Chapter 6 - Class 8





Reading Some Sample Programs


//******************************************************************
// Incomes program
// This program reads a file of income amounts classified by
// gender and computes the average income for each gender
//******************************************************************


//******************************************************************
// NotEqualCount program
// This program counts the occurrences of "!=" in a data file
//******************************************************************

These programs illustrate the use of while loops for the determination of the flow of control in a running program. Several types of terminating conditions are illustrated which will result in our exiting the loop.
 
 

Programming Exercises

  Solve these exercises in class, to your own satisfaction. When called for, create the appropriate data files and test your program on your data. Demonstrate your solutions to the instructor or to the class TA. There is nothing to hand in from this activity.
 
 

First Programming Project: Words

  Our first big programming project has just arrived -- and what a beauty it is! We will take as our specification of the problem to be solved, our text's Programming Problem 6.4, pages 323-324 (number of words). This programming project asks for two components: (1) a design of your algorithm to solve the problem, such as our authors have been systematically constructing for their case studies, and (2) a complete and correct implementation of your algorithm in C++. The algorithm design consists of two parts: (1.a) a hierarchical chart showing the structure of the computation, and (1.b) descriptions of the contents of the various modules appearing in your hierarchical chart. We will be making available some supporting materials, such as text files suitable for use as test data for your program and samples of student work in previous semesters. Look for them on the Academic Computing file server. Our course TA, Mr Kalita, has generously offered to make himself available as a consultant in algorithm design, but of course our purpose here is to help you to become more independent, not more dependent, so he will expect you to have put some serious thought into the enterprise.

Place an electronic copy of your work into the CS157 drop box before class time, 9:30:00 AM, next Tuesday, 27 February 1999. Personalize the results of your efforts by using the file-naming conventions explained in class. Hand in paper copies of your solutions at the beginning of class, 9:30:00 AM, 27 September 1999. The grader will use the paper copies for recording any comments he may wish to make about your work. Enjoy!