|
5. Construct a linked-list of structs to model the list of students given in table below, use the above mentioned provided code. The struct should contain at least one member pointer to the next variable of the struct type in the list. Now try answering the following questions: a. Write a function to as a user to enter the required data for each student. b. Write a function to print out the data for all students, in order shown in the table, without the table itself. c. Write a function to add a new student, that is, you with your valid BUEID) at the start of the list. Then use "a." above to print the data out. d. Write a function to add a new student, that is, you with your valid BUEID) at the end of the list. Then use "a." above to print the data out. e. Write a function to add a new student, that is, you with your valid BUEID) at the middle of the list. Then use "a." above to print the data out. f. Write a function to find the average of all students per subject. Print the output. g. Write a function to find the max and min of all students per subject. Print the output. h. Write a function to find the average, max and min subjects per student. Print the output. i. Do a, b, c above, again but to remove an item from the list, accordingly. j. Would a-d above be easier if we had pointers to the item before and the item after the current item-in the list- inside the struct type? Why? Please turn in all the print outs (and softcopy of source code) mentioned above. A demo is expected if this makes up for 0 mark due to plagiarism. Note: 1. To dynamically allocate memory use the new() function (or method) and to deallocate memory use delete() function (or method). 2. Please consult the figure below to imagine the different ways a linkedlist can be designed and implemented.
|