Question
C++ SORTING MERGE SORT METHOD Use the below Text File and write code that sorts it based on the users sort method selection. Please provide
C++ SORTING MERGE SORT METHOD
Use the below Text File and write code that sorts it based on the users sort method selection. Please provide a separate .cpp file wit hthe code containing the sort method. The sorting method uses the text file below and sorts it accordingly. Seperate the sorting method into an additional C++ file.
*********************************
Text File
Below is a text file called classes.txt. This text file lists, by course number and section number a series of computer science classes. This is the class number followed by a space and then the section number for that class (ex: 801 1203)
The contents of the file are: //Class Number Followed by Respective Class Section # 801 1203
801 7023
801 3108
802 1205
802 1206
802 3110
816 3113
830 7011
832 7038
834 3115
The Purpose of the program is to use the sorting method selected by the user to sort the above list by Section number (ex: 1203). This is the 4 digit number after the class number. IT should list the sort with the 4 digit number first followed by the 3 digit class number like the example below.
*********************************
How the Program Works
1. The program first displays a menu prompting the user to choose one of the following two sort method or exit (you can assume the user will choose a valid menu choice):
A. Merge
B. Exit
2. If the user chooses Exit, the program ends. Otherwise, the program loads the classes.txt text file provided above.
3. The program then sorts and displays the courses in ascending order of section number using the method chosen by the user. Just an example of a display below. //Example Output Ascending Section # followed by respective Class #
1203 801
1205 802
1206 802
3108 801
3110 802
3113 816
3115 834
7011 830
7023 801
7038 832
4. The program re-displays the menu in step #1.
*********************************
Files
In addition to the driver/main file, put the above sort method in a separate file. For example, for merge sort, there should be 1 .cpp file so on so forth. Should be a total of 2 files. 1 for the sort method and another for the main driver file.
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