| Lexington High School Mathematics | Math Dept. Front Page | Student Links | Family Links |
| Introduction to C++, Kevin Kelly | Kelly Front Page | C++ Course Guide | C++ Assignments | C++ Info |
For this assignment you have to write two short programs, 27A and 27B. Hand in both programs at once, along with a run of the programs (as described below).
Assignment 27 is a variation on your previous Assignment 7: Compact discs, in which you had the user type in information about a most favorite CD and a least favorite CD. The difference in this new assignment is that the information about the CD's will be stored into a file. Specifically, you must write the following two programs:
Program 27A: Ask the user to enter most and least favorite CD information, just as in Assignment 7. Store all this data into a file named cdinfo.dat.
Program 27B: Write a program that reads in the contents of the file cdinfo.dat, and prints out the information in the same way that you did in Assignment 7.
Running the programs: You must show that your two programs work correctly, using a sequence of commands like the following. You may enter any information you choose for the most and least favorite CD's, so long as multi-word names are used for at least some of the artists and/or titles.
[yourname@neon yourname]$ rm cdinfo.dat
[yourname@neon yourname]$ assign27a
(dialogue with the user about most/least favorite CD's)
[yourname@neon yourname]$ assign27b
(display of all the information about the two CD's)