# Assignment #5 Essay

2805 Words12 Pages
/* /// I created an extra function called sort_weigth in order to sort the structure array by name weigth (for the binary search of names) /// everything works, still, I really hope I didn't forget anything... Define a structure called Class (with uppercase C) with the following data: title, units and grade. Define a structure called Student with the following data: name (full name), gpa, and classes which is an array of Class structures (all the classes the student has taken so far). Write an initialize function that receives an array of Student structures and its size and sets the gpa of all to 0.0. In main, create 50 Students and call the above function to initialize the gpa for all 50 Students to 0.0. Then, pass the array of student structures and its size to a read function that will read student data from the user and store the entered data in the array of student structures. The user will enter student name followed by the class title, units and grade received for each class he or she has taken. When finished entering class information for a student, the user will just press Enter (an empty string) and to end entering more students, he or she will do the same for the student name. Once all Students have been entered, pass each element of the array of Student structures (element by element) to a gpa function which will compute and return the gpa for each Student using the classes array within each Student structure which contains the units and grade for each class taken by the student. Store the gpa returned by the above function in the gpa member of the Student structures. GPA is calculated by multiplying the number of units for each class by the points received for that class, and then adding all these products together and dividing it by total number of units. The points received for a class is based on the