The purpose of this lab is to give you practice with several C constructs, including:
You will write a program that reads students' names and exams scores from a file and stores each of students in an array. You wil then sort the students into ascending order based on their average exam score.
Here are some useful links to review from CS102 and CS140:
The ~bvz/cs140/www-home/fall-2008/labs/lab1 directory contains the following useful files:
exam_sort -d grades_file
In this part of the lab you are going to create a file called exam_sort.c that reads lines containing a name and a set of exam scores from a file whose name is given on the command line. Your program will read all the students into an array and then use selection sort to sort them into ascending order with the average exam score as a key. Once the input has been read and sorted your program will print the names in ascending order based on exam score. For example, if the input is:
mary 85 95 100 fred 67 82 53 susan 93 87 100 joe 91 72 85 barthowlomew 84 58 81then your output should be:
fred 67.33 barthowlomew 74.33 joe 82.67 mary 93.33 susan 93.33Note that mary and susan had the same average and that they were printed out in the same order that they appeared in the original input.
The program has the following specifications and requirements:
If you have not seen selection sort before or need to brush up on it then try this Wikipedia link.
You should submit a file named exam_sort.c. If you cannot complete the program as described then also include a README file that describes what your program is able to accomplish.