CO311: Introduction to Modern Programming II

Lab Practical #2: February 7, 2000

You will be randomly assigned one of the two following exercises to re-write.

  1. solution to Exercise 4.57 (Sample Answer)
  2. solution to Exercise 4.58 (Sample Answer)

Versions of both of these programs are available on the website; you can use your own version you wrote for CO211 if you’d like.

You will need to re-write the “single main” program into a multiple-function program, in the same fashion as done in class examples on January 31. Like the examples, the finished program will have separate functions each replacing the work and output “functional units” of the original program. To make things a little easier, the individual requests to “enter a number” can be considered part of the “work” portion of the program.

You must decide on good names for your functions, as well as the proper prototypes and parameters.

The finished code must compile and run identically to the original.

Submit the finished CPP file (and the original program if you do not use one of the supplied solutions) to the FTP site in its own folder called P2.

You will have 45 minutes to complete the assignment.