Question: C++ Programming: Write a program that performs the following tasks: Display a friendly greeting to the user Prompt the user for a file name Accept

C++ Programming:

Write a program that performs the following tasks:

Display a friendly greeting to the user

Prompt the user for a file name

Accept that file name

Attempt to open the file for input (see note below)

On failure, display an appropriate error message and exit

Read the data in the file and populate an array

Display the array

Copy the original array

Sort the copy using exchange sort

Display the array

Display the metrics (number of comparisons and number of exchanges)

Sort the now-sorted array again using exchange sort

Display the array

Display the metrics (number of comparisons and number of exchanges)

Reverse the array

Display the now-reversed array

Sort the reversed array using exchange sort

Display the array

Display the metrics (number of comparisons and number of exchanges)

Repeat the above block for insertion sort and for selection sort

Write a summary paper in which you give results for an array of 10,000 random integers and state whether or not the metrics produced by your program are consistent with predictions made in class.

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!