C++ SORTING – BUBBLE 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. Bubble
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 bubbe 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.