Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

Students also viewed these Databases questions

Question

Evaluate the importance of the employee handbook.

Answered: 1 week ago

Question

Discuss the steps in the progressive discipline approach.

Answered: 1 week ago