Question: This program aims to write a C++ program that uses the array of structs to maintain the top hit songs in the between 2012 and
This program aims to write a C++ program that uses the array of structs to maintain the top hit songs in the between 2012 and 2015.
First, your program reads from a data file named topsongs.dat. Each song in this data file is described by four information: (1) the rank of the song at the end of the year, (2) the name of the artist, (3) the title of the song, and (4) the year the song debut. An example song record is shown below:
1 ! number 1 ranked song
Katy Perry ! artist name
Dark Horse ! song title
2014 ! billboard year
There can be a maximum of 500 song records in the data file.
To allow the user to interact with the program, display a menu as the following. The program should allow the user to continually interact with the program by selecting menu choices 1 4 repeatedly. The program only terminates when the user selects the menu choice 5.
If the user selects choice 1, (s)he should be prompted to enter the name of the artist. The program then displays ALL the songs by this artist that have appeared in the billboard charts in the past 4 years. If the artist does not have any top songs in the past 4 years, an error message should be displayed; Display information about the songs in tabular format using setw(number). For example, if the name of the artist entered is: Beyonce, the output of the program should be: Here are the songs by Beyonce Title Rank Year Drunk in Love 22 2015 Partition 72 2015 Best Thing I Never Had 57 2012 Countdown 100 2012 If the user selects choice 2, (s)he should be prompted to enter the year to look for. The program displays the titles of ALL the songs in that year in table format. Billboard Top Song (2012-2015) Management Please select from the following menu choices: 1. Look up top hits by artist 2. Look up top hits by year 3. Add a new song 4. Delete an existing song 5. Exit 2 If the user selects choice 3, (s)he should be prompted to enter the following information: (1) the title; (2) the artist name, (3) the rank, and (4) the year of a new song. This new song record should then be added to the end of the list of songs. If the user selects choice 4, (s)he should be prompted to enter the title of the song to be deleted. The program then deletes the song from the array. If no such song is found, display an error message. If the user selects 5, the program terminates. Programming requirements A separate function named PrintByArtist should be used that displays all the songs by an artist. This function takes as parameters: the array of songs, the number of songs, and the artist name. A separate function named PrintByYear should be used that displays all the songs in a year. This function takes as parameters: the array of songs, the number of songs, and the year value. A separate function named AddSong should be used that add a new song into the list of songs. This function takes as parameters: the array of songs, the number of songs. A separate function named DeleteSong should be used that delete a song from the list of songs. This function takes as parameters: the array of songs, the number of songs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
