Your program will maintain the following:
• an array of student records, in the order they are entered, as shown at center above
• an array of pointers that orders the records by increasing ID, as shown above left
• an array of pointers that orders the records by decreasing GPA, as shown above right
• an array of pointers that orders the records alphabetically by name (not shown above)
This program is meant to be more interactive than your previous assignments. Your program should prompt the user for the number of students, and accept that value as input. All arrays used by your program should be dynamically allocated to be exactly this size.
For each student, your program should then prompt the user for the information listed below. For each student, all this information should be entered on one line, in the order shown, separated by spaces.
• ID number (int value between 1000 and 9999)
• name (character string, maximum length 20)
• GPA (double value between 0.0 and 4.0 inclusive)
Note that, in the example above, there are no spaces in the names. Rather, the underscore character ‘_’ is used in place of any spaces inside a name. This makes it easier to input the names using cin.
Your program should error check the user’s input, making sure it adheres to the specifications above. Any deviation should result in an error message clearly indicating the error and the user being asked to re-enter all data for that student.
Processing and Output
Your program is expected to update all four arrays, maintaining the proper order of each array at all times. When a new student’s information is input, your program needs to first insert the new student record into the array of student records. Then, your program needs to insert into each pointer array, a pointer to the new record in the place appropriate for that array. Please note that this does not mean you do a complete sort of each array every time a new record is created. Rather, you must identify the position in each array where the pointer should be inserted, and you should insert it there, moving any pointers that need to follow that pointer in the array as needed. To insure that your program is functioning properly, for each student is entered the list should be displayed four times: 1) unordered, 2) ordered by ID, 3) ordered by GPA, 4) ordered by name.
See the sample program run that follows for an example of how a run of your program should look on the screen. The user input is shown in bold italics for illustrative purposes.
Dear Student, We have reviewed your assignment thoroughly based on details of your assignment... View the full answer