Question: #define MAX_LEN_NAME 20 #define MAX_GRAD_STUDENTS 5 #include #include #include typedef struct justATag { char name [MAX_LEN_NAME]; char supervisor [MAX_LEN_NAME); int numCoursesDone; float currentPercentage; } gradStudent;

 #define MAX_LEN_NAME 20 #define MAX_GRAD_STUDENTS 5 #include #include #include typedef struct

justATag { char name [MAX_LEN_NAME]; char supervisor [MAX_LEN_NAME); int numCoursesDone; float currentPercentage;

} gradStudent; a. Write a function definition for read1 Grads, given the

#define MAX_LEN_NAME 20 #define MAX_GRAD_STUDENTS 5 #include #include #include typedef struct justATag { char name [MAX_LEN_NAME]; char supervisor [MAX_LEN_NAME); int numCoursesDone; float currentPercentage; } gradStudent; a. Write a function definition for read1 Grads, given the following prototype: void read1Grads (FILE * file, gradStudent gsArray (MAX_GRAD_STUDENTS]); This function will read grad information from a FILE pointer variable named file, line by line (one line for each member of a gradStudent), into gsArray array. You may refer to file1.txt for this format. In normal operation, this function will read in exactly MAX_GRAD_STUDENTS lines. For example, of file1.txt contains: Harry Dang Ria Jonas 3 87 Isabella Mensah Ritu Chaturvedi 2 90 Larry Washington Joe Zinga 3 78 Then gsArray [O] will contain the following members: name: Harry Dang supervisor: Ria Jonas numCoursesDone: 3 currentPercentage: 87 And so on for other elements of gsArray. b. Write a function definition for read2Grads, given the following prototype: int read2Grads (FILE * file, gradStudent gsArray [MAX_GRAD_STUDENTS]); This function will read grad information from a FILE pointer variable named file, line by line (one line for each gradStudent), into gsArray array. You may refer to file2.txt for this format. For example, if file2.txt contains the following: (note there is a reason why names such as HarryDang are given without spaces bear it with me for this worksheet ) HarryDang RiaJonas 3 87 IsabellaMensah RituChaturvedi 2 90 LarryWashington JoeZinga 3 78 Then gsArray [O] will contain the following members: name: Harry Dang supervisor: Ria Jonas numCoursesDone: 3 currentPercentage: 87

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!