Question
In C++, how to do the following? Text File Create a text file called classes.txt . This text file lists, by course number and section
In C++, how to do the following? Text File
Create a text file called classes.txt. This text file lists, by course number and section number, the CSIT courses offered this semester. You can use the online schedule as an information source. You do not have to list all of the CSIT classes, just enough so I can test your program (say 10).
The contents of the file could state: 801 7045 801 1206 801 3450 802 1688 802 3285 808 3278 (and so on)
Note that the courses are listed by course number. You can also list them in random order. However, do not list them by section number. That is what your program will do.
How the Program Works
The program first displays a menu prompting the user to choose one of the six sort methods covered in Section 10.1 of the book, or exit (you can assume the user will choose a valid menu choice):
Selection
Bubble
Insertion
Heap
Quick
Merge
Exit
If the user chooses Exit, the program ends. Otherwise, the program loads the classes.txt text file which you created.
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: 1209 839 1688 802 3112 870 3278 808 3285 802 3450 801 7045 801
The program re-displays the menu in step #1.
Files
In addition to your driver file, put each of the 6 sort methods in a separate file or files. For example, for merge sort, you can have 1 .cpp file, or split that code into an .h and a .cpp file. Therefore, you'll have at least 7 code files, and possibly as many as 13. You also will have your classes.txt text 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