Question: 2. Professor C. is working on putting together a CD full of some of his favorite songs, and he wants to get his money's

+A Read aloud Draw2. Professor C. is working on putting together a CD full of some of his favorite songs, and he wants to





2. Professor C. is working on putting together a CD full of some of his favorite songs, and he wants to get his money's worth by using as much space on the CD as possible. Given a list of acceptable songs to go onto the CD along with its size, write a C++ program to determine the closest to filling the CD he can get. James obviously does not want to be stuck listening to the same song twice on the CD, so he is restricted to only use each song one time. The first line of the datafile will contain a single integer n that indicates the number of data sets that follow. Each data set will begin with a time in the format "MM:SS", that will not exceed 59:59, representing the amount of song time the CD can hold, followed by a single integer m denoting the number of songs to follow. The second and final line of each test case will consist of m times in the same format as above. Output to the screen, each CD labeled, and output the largest amount of song-time that will fit on the CD without exceeding its capacity in the format "MM:SS" Let the user input the file name from the keyboard. Refer to the sample output below. Sample File: 15:00 10 01:00 02:00 03:00 04:00 05:00 06:00 05:00 03:00 02:00 01:00 59:00 6 15:00 15:00 15:00 16:00 20:00 27:00 01:00 2 2:00 1:01 Sample Run: Enter file name: cdtimes.txt CD 1: 15:00 CD 2: 58:00 CD 3: 00:00 Name the program: CDF111xx.cpp, where XX are your initials.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a C program to solve the problem as described include include include include include using na... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!