# include & ltstdlib.h & gt
# include & ltstring.h & gt
Structural stud
{
Long num
char name[20];
Double integral;
};
Typedef structure stucode
{
Structural research students;
struct stucode * next
} L;
void menu();
void create list(struct stu code * * r);
void out(struct stu code * r);
void search 1(struct stu code * r);
void search 2(struct stu code * r);
void del(struct stu code * * r);
void insert(struct stu code * * r);
void sort(struct stu code * * r);
void main()
{
Char selection;
int flag = 1;
struct stucode * r = NULL
While (sign)
{
System ("CLS");
menu();
choose = getchar();
Switch (select)
{
Case "1":
Create a list (& ampr);
out(r);
Printf ("Test function1\ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "2":
search 1(r);
Printf ("Test function1\ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "3":
Search 2 (r);
Printf ("Test function1\ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "4":
Del (& Ampr);
out(r);
Printf ("Test function1\ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "5":
Insert (& ampr);;
out(r);
Printf ("Test function1\ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "6":
Sorting (& AMPR);
out(r);
Printf ("Test function1\ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "7":
out(r);
Printf ("Test function 7 \ nPress any key to continue \ n");
getchar();
getchar();
Break;
Case "0":
flag = 0;
printf("The end。 \ n ");
Break;
Default value: printf ("\ nWrong selection! (Wrong selection, please re-select! )\ n”); getchar(); getchar();
}
}
}
void create list(struct stu code * * r)
{
struct stucode *p,* t;
Dragon n;
char a[20];
Double s;
if(* r)* r = NULL;
Printf(" \n n nPlease enter: \ n Student ID (please arrange in ascending order) name score (please enter three zeros to end) \ n ");
Scanf("%ld%s%lf ",¬ applicable. s);
If(n==0) returns;
p =(L *)malloc(sizeof(L));
p->; student . num = n;
strcpy(p-& gt; student.name,a);
p->; student . score = s;
p->; next = NULL
* r = p;
Scanf("%ld%s%lf ",¬ applicable. s);
When (noun)
{
t = p;
p =(L *)malloc(sizeof(L));
p->; student . num = n;
strcpy(p-& gt; student.name,a);
p->; student . score = s;
p->; next = NULL
t->; next = p;
Scanf("%ld%s%lf ",¬ applicable. s);
}
}
void search 1(struct stu code * r)
{
Long x;
If (! r)
{
Printf ("There is no student information to query! \ n ");
Return;
}
Printf ("Please enter the student number of the student information to be queried: \ n");
scanf("%ld ",& ampx);
And (r& & amp->; Student. num! =x)
r = r-& gt; Next;
if(r==NULL)
Printf ("Error! There are no such students! \ n ");
other
printf("%ld %s %.2lf\n ",r-& gt; Student.num, r- > student name, r-> student . score);
}
void search2(struct stucode *r)
{
char m[20];
If (! r)
{
Printf ("There is no student information to query! \ n ");
Return;
}
Printf ("Please enter the student name of the student information to be queried: \ n");
scanf("%s ",m);
And (r & strcmp (r->; Student name, m))
r = r-& gt; Next;
if(r==NULL)
Printf ("Error! There are no such students! \ n ");
other
printf("%ld %s %.2lf\n ",r-& gt; Student.num, r- > student name, r-> student . score);
}
void del(struct stucode **r)
{
Long k;
struct stucode *p=*r,* t;
If (! (*r))
{
Printf ("There is no student information to delete! \ n ");
Return;
}
Printf ("Please enter the student ID of the student information to be deleted: \ n");
scanf("%ld ",& ampk);
If (p->; Number of students ==k)
* r =(* r)-& gt; Next, free (P);
other
{
while(p->; next & amp& ampp->; Next-> Student. num! =k)
p = p-& gt; Next;
If (p->; next==NULL)
Printf ("Error! There are no such students! \ n ");
other
{
t = p-& gt; Next;
p->; next = p-& gt; Next-> Next;
Free (t);
}
}
}
Null insertion (structure stucode **r)
{
Dragon n;
char a[20];
Double s;
L *p,*t,* k;
Printf ("Please enter the student number name score of the student information to be inserted: \ n");
Scanf("%ld%s%lf ",¬ applicable. s);
p =(L *)malloc(sizeof(L));
p->; student . num = n;
p->; student . score = s;
strcpy(p-& gt; student.name,a);
If (! (*r))
{
* r = p;
(* r)-& gt; next = NULL
Return;
}
If (p->; Student number & lt (* r)-> Number of students)
p->; next=(*r),(* r)= p;
other
{
t = * r;
k = t;
while(t->; next & amp& ampt->; Next-> Student number & lt = p->; Number of students)
t = t-& gt; Next;
p->; next = t-& gt; Next;
t->; next = p;
* r = k;
}
}
Void sort (struct stucode **r)
{
struct stucode *t,*p,*q,* z;
If (! r)
{
Printf ("There is no student information to sort! \ n ");
Return;
}
If (! (*r)||! (* r)-& gt; Next)
Return;
t = * r;
p = t-& gt; Next;
t->; next = NULL
while(p)
{
q = p->; Next;
If (p->; Students. Score & gtt->; student.score)
{
p->; next = t;
t = p;
}
other
{
z = t;
while(z->; next & amp& ampz-& gt; Next-> Student. Score & gt = p->; student.score)
z = z-& gt; Next;
p->; next = z-& gt; Next;
z-& gt; next = p;
}
p = q;
}
* r = t;
}
void out(struct stucode *r)
{
printf(" \ n \ n ");
If (! r)
{
Printf ("There is no student information to output! \ n ");
Return;
}
while(r)
{
printf("%ld %s %.2lf\n ",r-& gt; Student.num, r- > student name, r-> student . score);
r = r-& gt; Next;
}
printf(" \ n \ n ");
}
Invalid menu ()
{
Printf("\n Student Information Management System \ n ");
Printf ("\ nmenu \ n \ n");
Printf("\n 1 Create a linked list and display it \ n ");
Printf("\n 2 Find the student information of a student number \ n ");
Printf("\n 3 Find student information of a certain name \ n ");
Printf("\n 4 Delete the student information of a student number \ n ");
Printf("\n 5 Insert new student information \ n ");
Printf("\n 6 output in descending order of fractions \ n ");
printf(" \ n 7 output \ n ");
printf(" \ n exit \ n ");
Printf ("\ nPlease select an option to execute: \ n");
}