Question: In C++, No pointers or vectors, Create a program that will read a file and load data by using structs and arrays. Also Song struct

In C++, No pointers or vectors, Create a program that will read a file and load data by using structs and arrays. Also Song struct has members of type Artist and Time.

C++ structs

Artist: Name(string), CountryOfOrigin(string)

Time: Minutes(int),Seconds(int)

Song: Title(string),Artist(Artist), Length(Time)

Functions:

LoadSongDataFromFile

Loads song data from a user specified file. This function should first prompt the user to enter a filename. Next it should open the file that the user specified. After that it should read in the song data from that file into the song array parameter.

// Function prototype

void LoadSongDataFromFile(Song s[])

ShowSongData

Writes ALL data inside the song array to standard output.

// Function prototype

void ShowSongData(Song s[])

GetTotalTime

This function should iterate through the array and calculate the total time for all songs stored in the array.

Important: The Time that is returned must have seconds less than 60 or it will be marked as incorrect.

// Function prototype

Time GetTotalTime(Song s[])

Create the structs as listed above.

Create the functions as listed above.

Create an array of Song in main that has a size of 5.

You need to create a loop in main that will show a menu like the following below.

Song Program

---------------

1 - Load song data from file

2 - Show all song data

3 - Show total time

4 - Exit

Enter Choice:

Important: You must call the functions that you wrote to do what the user wants done for the given menu selection.

Song Input File Format

Title

ArtistName

CountryOfOrigin

Minutes

Seconds

Title

ArtistName

CountryOfOrigin

Minutes

Seconds

Song Sample Input Data File (example)

In The Air Tonight

Phil Colins

United States

3

30

Night Of Fire

Intiatal D

Europe

2

38

Gucci Gang

Gucci Gang

USA

3

20

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!