Question: / / / = = = = = = = = = = = = PART 1 : FIXED code = = = = =

///============ PART 1: FIXED code ==========///
///====== DON'T CHANGE THIS PART ============///
#include
#include
#define MAX_WORD_CHAR 100
#define GPA "GPA"
#define DATE "DATE"
struct Date
{
int year;
int month;
int day;
};
typedef struct Date Date;
struct Node
{
Date dob;
float gpa;
struct Node *next;
};
typedef struct Node Node;
void readData(FILE *, char **, float *, Node **, Node **);
Node *mergeList(Node *, Node *);
Node *filterList(Node *, char *, float);
Node *reverseList(Node *);
void printList(Node *);
int main()
{
FILE *fp = fopen("DATA.IN","r");
Node *headL1= NULL;
Node *headL2= NULL;
char *controlString;
float targetGPA;
readData(fp, &controlString, &targetGPA, &headL1, &headL2);
printList(headL1);
printf("
");
printList(headL2);
printf("
");
Node *head = mergeList(headL1, headL2);
head = filterList(head, controlString, targetGPA);
head = reverseList(head);
printList(head);
fclose(fp);
}
///============ PART 2: Student works ==========///
// Define supported functions here.
//
void readData(FILE *fp, char **controlString, float *targetGPA, Node **headL1, Node **headL2)
{
// TODO: read data with file pointer fp:
// LINE1: controlString targetGPA
//(LT or GT)(float number)
// LINE2: headL1 is the head of list
// LINE3: headL2 is the head of list
}
Node *mergeList(Node *headL1, Node *headL2)
{
// TODO: add list 2 into the end of list 1, return the head of result list
}
Node *filterList(Node *head, char *controlString, float targetGPA)
{
/*
TODO: Filter the third list based on GPA criteria.
If controlString is "LT", filter the students with a GPA less than targetGPA.
If controlString is "GT", filter the students with a GPA greater than targetGPA.
return head of filtered list
*/
}
Node *reverseList(Node *head)
{
// TODO: reverse the list
// return the new head
}
void printList(Node *head)
{
// TODO: print the linked list to stdout
}

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!