#include
#include
20 # define N
Typedef struct information {
Int ID;
char name[20];
int num;
Int time;
Char book [10].
} xinxi;
Typedef struct Node {
Xinxi data;
Struct Node * next;
} Node, * LinkList;
Typedef struct paiming {
char name[20];
int num;
[20]} r, z;
Void input (LinkList & amp; The head);
Int Search (LinkList head, int n);
Void search (LinkList head);
Void the update (LinkList head);
Void shuju (LinkList head);
Void jieshu (LinkList head);
Void huangshu (LinkList head);
Void xujie (LinkList head);
Void zoulian (LinkList head, int n);
Void shangchu (LinkList & amp; The head);
Int main ()
{
LinkList head=NULL;
int n;
Do {
printf("\n");
Printf (" 1. Registered \ n ");
Printf (" 2. Search \ n ");
Printf (" 3. Modify \ n ");
Printf (" 4. Query data \ n ");
Printf (" 5. Borrow books \ n ");
Printf (" 6. Also book \ n ");
Printf (" 7. Renew \ n ");
Printf (" delete 8. \ n ");
Printf (" 9. Quit \ n ");
The scanf (" % d ", & amp; N);
The switch (n)
{
Case 1: input (the head); break;
Case 2: search (the head); break;
Case 3: the update (head); break;
Case 4: shuju (head); break;
Case 5: jieshu (head); break;
Case 6: huangshu (head); break;
Case 7: xujie (head); break;
Case 8: shangchu (head); break;
Case 9: break;
Default: printf (" error!" ); break;
}
}
while(n!=9);
return 0;
}
Void input (LinkList & amp; The head)//input
{
Int loc;
LinkList pre, p;
Xinxi stu.
Printf (" input student id, name, book number, borrowing time: \ n ");
The scanf (" % d % d % d % s ", & amp; Stu. ID, stu. Name, & amp; Num. Stu., & amp; Stu. Time);
P=(LinkList) malloc (sizeof (Node));
P - & gt; data=https://bbs.csdn.net/topics/stu;
If (head==NULL) {
The head=p;
The head - & gt; Next=NULL;
}
The else {
Loc=Search (head, stu. ID);
If (loc==0) {
P - & gt; Next=head - & gt; Next;
The head - & gt; Next=p;
P - & gt; Next=NULL;
}
}
}
Int Search (LinkList head, int n)//find the same
{
Int flag=0;
LinkList p;
P=the head;
While (p!=NULL) {
If (p - & gt; Data. The ID==n)
Flag=1;
The else {
P=p - & gt; Next;
}
}
return flag;
}
Void search (LinkList head)//query
{
Int flag=1;
int num;
LinkList pre.
The pre=head;
Printf (" input query student number: ");
The scanf (" % d ", & amp; Num);
While (pre!=NULL& & Flag) {
If (pre - & gt; Data. The ID==num)
{
Name: printf (" % s \ n number of books: % d \ n borrowing time: % d \ n ", the pre - & gt; Data. The name, the pre - & gt; Data. The num, pre - & gt; Data. Time);
Flag=0;
}
The else {
The pre=pre - & gt; Next;
}
}
If (flag)
Printf (" no query to!" );
}
Void the update (LinkList head)//modify
{
Int num, flag=1;
LinkList pre.
The pre=head;
Printf (" input to modify student number: ");
The scanf (" % d ", & amp; Num);
While (pre!=NULL& & Flag) {
If (pre - & gt; Data. The ID==num)
{
Printf (" input change name, lending, borrowing time ");
The scanf (" % s % d % d ", the pre - & gt; Data. The name, & amp; The pre - & gt; Data. The num, & amp; The pre - & gt; Data. Time);
Flag=0;
}
The else {
The pre=pre - & gt; Next;
}
}
If (flag)
Printf (" no query to!" );
}
Void shuju (LinkList head)//data list
{
Int I=0, j, k, t;
Z team;
R p;
LinkList pre.
The pre=head;
Printf (" readings: \ n ");
While (pre!=NULL) {
Printf (" % s % d ", the pre - & gt; Data. The name, the pre - & gt; Data. The num);
The pre=pre - & gt; Next;
}
While (pre!=NULL) {
P [I] num=pre - & gt; Data. The num;
Strcpy (p [I]. The name, the pre - & gt; Data. The name);
The pre=pre - & gt; Next;
i++;
}
T=I;
for(j=0; j
k=j;
For (I=j + 1; i
If (p [k]. Num & gt; P [I] num)
k=i;
if(k! J)={
Team=p [k].
P=p [k] [j];
P=team [j];
}
}
Printf (" borrowing ranking: \ n ");
For (I=t; I>=0; I -) {
Printf (" % s % d ", p [I]. Name, p [I] num);
}
Printf (" did not return on time in book (books a month longest) : \ n ");
While (pre! nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull