Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. (10pt) Suppose we store student IDS and their names in a single linked list.

ID: 3572829 • Letter: 4

Question

4. (10pt) Suppose we store student IDS and their names in a single linked list. In addition to ID. name and next fields, each cell in this list contains a pointer (say courses) to access another single linked list where we store some information about the courses taken by each student. Suppose we store only course code (cs2123), letter grade, and next fields. Specifically, we use the following structures to store students and their courses. typedef struct course cell char code [7 cs2123 char letter grade struct course cell next cours eTi typedef struct student cell int ID char name [20] struct student cell next. course *courses, Suppose somehow we created the below data structure using the above structures. start 23 "P.M. T.K Z.Y NULL cs2123 "cs, 1143" "cs2123" NULL Now implement void D Class tude nt' Start har code which isplay lists the students' ID, name and grade in the given course. For example, it generates the below table when we call it as Displayc la ss (start, "cs2123") Course name: cs2123 Note: Don't worry about the format and ID Name Grade spaces too much, just generate the list and make sure that you have the header as 23 shown and one student in each line! 30 Also standard libraries are included!

Explanation / Answer

void DisplayClass(StudentT *start, char *code)
{
   printf("Course name: *s ",code);
   printf("ID Name Grade ____ ____ ____ ");
   struct student_cell *temp=start;
   struct course_cell *temp2;
   while(temp!=NULL)
   {

if(temp->courses==NULL)
{
   temp=temp->next;
   continue;
}

temp2=temp->courses;
while(temp2!=NULL)
{
   if(strcmp(temp2->code,code)==0)
   {
       printf("%d %s %c ",temp->ID,temp->name,temp2->letter_grade);
   }
else
   temp2=temp2->next;

}
temp=temp->next;

   }


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote