/**** #include file student.h ****/ #include #include #define MAX_NUMBERLIST 40 #define MAX_NAMELENGTH 30 /* #define MAX_STUDENTS 450*/ #define MAX_STUDENTS 20 typedef struct{ int count; double numbers[MAX_NUMBERLIST]; } NumberList; typedef struct{ char firstName[MAX_NAMELENGTH]; char middleInitial; char lastName[MAX_NAMELENGTH]; } FullName; typedef struct { FullName sName; NumberList quizzes; NumberList homeworks; } StudentRec; /**** Function Prototypes ****/ /*int*/ void readIntoStudentArray (char fName[], StudentRec students[], int maxStudents, int *count); /*Reads data from a file into an array. fName is the external name of a file (which is assumed to exist). StudentRec is an array. maxStudents is the physical size of the array. count points to the actual number of records stored in the array. The function guarantees that the count is <= maxStudents. */ int compareNames (FullName name1, FullName name2); /*name1 and names2 are assumed to be valid strings The function returns 0 if the two names are identical; returns a negative number if name1 comes before name2 returns a positive number if name2 comes before name1. "Comes before" has the usual sense for arranging names in alphabetical order. For example, the following list of names are considered to be in order: John B. Allan John B. Allen Susan B. Allen Susan C. Allen Phu X. Nguyen Phil R. Olde Adam A. Older */ double averageOfList (NumberList list); /*It is assumed that the list is valid. The average of the numbers in the list is returned. */ void sortStudents (StudentRec students[], int scount); /* It is assumed the array holds scount valid student records. After execution, the students in the array will be in alphabetical order by fullName. */ /********** Additional useful information *****/ /* The string.h library function strcmp: int strcmp(char string1[], char string2[]); returns 0 if the two strings are equal returns a negative value if string1 comes before string2 returns a positive value if string2 follows string1. */ /**** end of #include file ******/