#include <stdio.h> #include <stdlib.h> #define N 10typedef struct student{ int num; float score; Struct student *next;} Stu;stu *creat () { int i; stu *p,*head = NULL,*tail = head; for (i = 0; i < n; i++) { p = (stu *) malloc (sizeof (STU)); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;SCANF ("%d%f",&p->num,&p-> Score); p->next = null; if ( p->num <= 0) { free (p); break; } if (head == null) head = p; else tail->next = p; tail = p; } Return head;} Void print (stu *p) { while (p != null) { printf ("%d\t%.2f\n", P->num,p->score); p = p->next; }}stu *link (STU&NBSP;*P1, STU&NBSP;*P2) { stu *p,*head; if ( p1->num < p2->num ) { head = p = p1; p1 = p1->next; } else { head = p = p2; p2 = p2->next; } while ( (p1 != null) && (p2 != null ) { if (P1->num < p2->num) { p->next = p1; p = p1; p1 = p1->next; } else { p->next = p2; p = p2; p2 = p2->next; } } if (p1 != null) P->next = p1; else p-> Next = p2; return head;} Int main () { stu *a,*b,*c; printf ("\ n Please enter the information for List A, School number is less than or equal to 0 o'clock end input: Format (school number score) \ n "); a = creaT (); printf ("\ n Please enter the information for link list B, the number is less than or equal to 0 o'clock end input: Format (school number score) \ n"); b = creat (); printf ("\ nthe information for List A: \ n"); print (a); printf ("\ nthe information for List B is: \ n"); print (b); c = link (A, b); printf ("\ n" linked list information: \ n "); print (c); return 0;}
There are already a, a, a, two linked lists, each of which includes the number of points, scores. The two linked lists are required to be merged in ascending order by the number of studies.