| 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 |
Warning about a limitation of apstring: An ordinary C++ input
statement into an apstring variable stores only the first word of input.
Often that may not be the behavior you want. To allow for input that includes
spaces (such as a first name and a last name),
use a getline statement as shown below.
|
Write a program that will ask the user for several pieces of information about their most favorite compact disc and about their least favorite compact disc. For each disc, the user should be asked for at least the following information: artist, title, number of tracks, and year.
Your program must include a definition of a structure called CD that is capable of storing the information listed above. The information must be stored in two variables of type CD, called mostfavcd and leastfavcd.
After all of the information has been input and stored,
output the information from mostfavcd and leastfavcd
back to the user.
For 10 pts.: In addition to everything listed above, also include a nested structure that can store the names of individual band members. For example, mostfavcd.band.drums could contain the name "Ringo Starr".