Assume that a file, named stud_record.txt, contains 5 - 20 students’ records (you can download it from Webct.) The attributes in one student’s record includes the student’s ID, Name, Age, Mark, in sequence. For example,
001d, John, 18, 92
002d, Mary, 18, 93
……..
Design and implement a program to perform the following functions.
1. (5 marks) Read the students’ records from the file and show them on the screen in the following format:
001d, John, 18, 92
002d, Mary, 19, 93
………
2. (5 marks) Calculate the average grade of the students recorded in file stud_record.txt
3. (15 marks) Sort the students records in decreasing order, according to the marks of students. Print the sorted students’ records on the screen and into a file, namely stud_ranking.txt.
4. (10 marks) Display a student’s record on the screen according to the student’s ID input by the user.
5. (15 makrs) allow a user to first find a student’s record by specifying the student’s ID and then modify the student’s age and mark. After the modification, the updated record should be written into the file stud_record.txt.
Requirements:
1. (5 marks) Use an array of struct to read the students’ records from the file stud_record.txt and use this array to perform all the operations in the program.
2. (15 marks) Provide a text menu for users to select the operations. An examples is given below.
3. (5 marks) Use the Switch and Case statements to implement the menu function.
4. (5 marks) Develop a function for every operations in the menu. For example, the operation of “printing all students’ records” is corresponding to the function print_all_students(). Another example is the operation of “update a student’s record” which is corresponding to the function update_record ().
How to submit
Please submit a source file, named Fabo.c, for Question 1, and s a source file, named Student.c, for Question 2. Compress the two files into a .zip or .rar package, with your student ID as . Then, submit the compressed package via WebCT.