Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your band is playing a gig and has come up with a list of songs, which you have stored in a file called FavoriteSong.txt. The

Your band is playing a gig and has come up with a list of songs, which you have stored in a file called FavoriteSong.txt. The set list may contain up to 20 songs.

Write a C++ program that does the following:

Read the file into an array.

Pass the array in a function that will sort the array (either selection sort or bubble sort.)

Request from the console a song to search for.

Write a function that will perform a binary search on the array.

Display that the song is on the list or not on the list depending on if you found it.

Continue processing songs until END is typed in.

Please refer to the textbook for the sorting/searching algorithms and sample code.

Example Input and Output

The contents of this file should look like this:

Green Onions

Hold On, Im Coming

Night Train

Respect

Ninety-Nine and a Half

The Thrill Is Gone

Soul Man

The display should look like this:

Reading FavoriteSongs.txt file into array

Sorting array

Sorting done

Please enter a song or END to terminate: Respect

Respect is on the set list

Please enter a song or END to terminate: Knock on Wood

Knock on Wood is NOT on the set list

Please enter a song or END to terminate: END Program ends

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Describe the five elements of the listening process.

Answered: 1 week ago