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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started