Question
// Q1 : addSort (30 points) // This function is used to add a student into the list and making sure the list is sorted
// Q1 : addSort (30 points) // This function is used to add a student into the list and making sure the list is sorted at all times. // The list has to be sorted at all times. You can add the student at the end of the list and then sort the list. // Sort can be implemented as a different method and call it everytime you add a record. // Use a temp struct (already declared) if you need to swap two structs in your logic. // Do not allow the student to be added to the list if it already exists in the list. You can do that by checking student names already in the list. // If the student already exists then return 0 without adding it to the list. If the student does not exist in the list then go on to add the student at the end of the list, sort the list and return 1. // If student list is full, then do not add new student to the list and return 2. // NOTE: Notice how return type of addSort() is checked in case 'a' of executeAction() // NOTE: You must convert the string 'schoolYear_input' to an enum type and store it in the list because the school year has enum type (not string type). // The list should be case sensitive. For instance, 'Roger' and 'roger' should be considered two different names. // Hint: 'count' holds the number of students currently in the list int addSort(char* studentName_input, char* major_input, char* schoolYear_input, unsigned int studentID_input) { struct studentRecord studentTemp; // needed for swapping structs. Not absolutely necessary to use. return 0; // edit this line as needed
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