çå¯ä¸å¯ä»¥ä¾åè
é¢ç®ï¼å°åå¾ä¹¦ç®¡çç³»ç»
ç级ï¼00090B5ç
ç»å«ï¼ç¬¬ä¸ç»
ç»é¿ï¼æä¿æ° å¦å·ï¼28
ç»åï¼å¼ æ å¦å·ï¼31
éç»å¤ å¦å·ï¼15
åå²³ å¦å·ï¼13
é©æé¢ å¦å·ï¼39
å®ææ¥æï¼2002å¹´7æ10æ¥
ä¸ãéæ±åæï¼
1ãç¨åºçè¾å
¥ï¼åªéæç³»ç»æ示è¾å
¥æ´åæ°åæè±æåæ¯å³å¯ãæ¯æ¬¡æ°æ®çè¾å
¥å以å车符ä½ä¸ºç»ææ å¿ã
2ãç¨åºçè¾åºï¼æ¯ä¸é¡¹æ°æ®è¾åºåææ±åçæ示ï¼è¾åºæ ¼å¼å为æ´åæå符串ã
3ãç¨åºçç³»ç»åè½ï¼
(1)ãå¾ä¹¦åºç³»ç»ç®¡çï¼
(2)ãåé
è
ä¿¡æ¯ç管çï¼
(3)ãæ¥å¸¸å书è¿ä¹¦æä½ï¼
(4)ãæ ¹æ®éè¦æä¾å¯¹å¾ä¹¦æéçæ¥è¯¢æ¹å¼ã
4ãæµè¯æ°æ®ï¼åéï¼ã
äºãæ¦è¦è®¾è®¡ï¼
1:æ¬ç³»ç»å
æ¬ä¸¤ä¸ªæ½è±¡æ°æ®ï¼å¾ä¹¦åºé¾è¡¨åå书è
é¾è¡¨ã
(1)å®ä¹å¾ä¹¦é¾è¡¨ç±»å为ï¼
ADT Abook
æ°æ®å¯¹è±¡ D={bi|bi=Booktype,i=1â¦â¦n n>=o}
æ°æ®å
³ç³» R={<bi-1,bi>|(bi-1,bi)=D,i=2â¦â¦n}
åºæ¬æä½ï¼
Insert(n)
æä½ç»æï¼å»ºç«ä¸ä¸ªé¿åº¦ä¸ºnçé¾è¡¨ææå
¥n个æ°ç»ç¹ã
Del(n)
æä½ç»æï¼ä»å·²å»ºç«é¾è¡¨ä¸å é¤n个ç»ç¹ã
Print( )
æä½ç»æï¼è¾åºå·²å»ºç«é¾è¡¨ã
Search( )
æä½ç»æï¼æè¦æ±æ¥æ¾å¹¶è¾åºå·²å»ºç«é¾è¡¨ä¸çç»ç¹ã
Borrow( )
æä½ç»æï¼æè¦æ±æ¹å已建ç«é¾è¡¨ä¸æä¸ç»ç¹çç¸å
³ä¿¡æ¯ ã
return( )
æä½ç»æï¼æè¦æ±æ¹å已建ç«é¾è¡¨ä¸æä¸ç»ç¹çç¸å
³ä¿¡æ¯ ã
(2)å®ä¹å¾ä¹¦é¾è¡¨ç±»å为ï¼
ADT Aborrow
æ°æ®å¯¹è±¡ D={ri|ri|borrowtype,i=1â¦â¦n n>=1}
æ°æ®å
³ç³» R={<ri-1,ri>|ri-1,ri=D,i=2â¦â¦n}
åºæ¬æä½ï¼
creat(n)
æä½ç»æï¼å»ºç«ä¸ä¸ªé¿åº¦ä¸ºnçé¾è¡¨ã
Insert(n)
æä½ç»æï¼æå
¥n个æ°ç»ç¹å°å·²å»ºç«é¾è¡¨ä¸ã
Remove(n)
æä½ç»æï¼ä»å·²å»ºç«é¾è¡¨ä¸å é¤n个ç»ç¹ã
2:主ç¨åºçæµç¨ï¼ï¼è§éå¾ï¼
å 书 Lendbook ()
1ãæ ¹æ®åé
è
Look_for _borrower()
2ãæ ¹æ®ä¹¦å
Look_for_name()
3ãæ ¹æ®åºç社
Look_for_press()
4ãæ ¹æ®ä½è
Look_for_auther()
5ãèªå®ä¹æ¥æ¾
Look_for_word()
è°å
¥çé¢
è¿ ä¹¦ Returnbook ()
æ¥ è¯¢ Search ()
1ãæ°ä¹¦å
¥åº
Insert ()
2ãæ§ä¹¦å é¤
Del ()
3ãæ¥è¯¢åºå
è书
Print ()
å¾ä¹¦åºç®¡ç Kucaozuo ()
1ãç»è®°
2ã注é
åé
è
管ç
é åº
ä¸ã详ç»è®¾è®¡ï¼
1ï¼å¾ä¹¦ç±»å
struct booktype
{
int booknumber; /*书å·*/
char bookname[20]; /*书å*/
char auther[20]; /*ä½è
*/
char press[50]; /*åºçåä½*/
int price; /*å®ä»·*/
int pagenumber; /*页æ°*/
int nownumber; /*å½ååæ°*/
time_t borrowtime; /*å书æ¶é´*/
time_t returntime; /*è¿ä¹¦æ¶é´*/
char borrowernum; /*å书人è¯å·*/
struct booktype *next;
} *g_book_list;
2ï¼åé
è
ç±»åï¼
struct borrowertype
{
int cardnumber; /*å书è¯å·*/
char name[20]; /*å§å*/
char sex[10]; /*æ§å«*/
char tel[10]; /*èç³»çµè¯*/
char unit[80]; /*å·¥ä½åä½*/
int lendnumber; /*å书æ°ç®*/
int booknumber; /*æå书å·*/
struct borrowertype *next;
struct borrowertype *prev;
}
åãè°è¯åæ
1å¨æåè¿è¡æ¨¡åååæ¯æªå°å书人信æ¯ç®¡çä½ä¸ºä¸ä¸ªåç¬æ¸åï¼è´ä½¿è°è¯æ¶æ æ³æ确管çç»å书è
ä¿¡æ¯ï¼é æå书è
é¾è¡¨æ··ä¹±ï¼éæ°åé
å解å³äºè¿ä¸ªé®é¢
2 åå
æ³è¿è¡ä¸æ书åå人å½è¾å
¥è¾åºï¼ä½ç±äºæªè½æ¾å°ç¸å
³ä¿¡æ¯èµæï¼æ æ³å®æ该æä½ï¼æç»æ¾å¼è¯¥è®¾è®¡
3 æåæ们æ¾è§å®äºä¸äºåé以åç»æä½ï¼ä½éç设计çè¿è¡æ·±åï¼æåçç»æä½ååéæ æ³æ»¡è¶³éè¦ï¼è´ä½¿è°è¯æ¶åºç°ä¸å°æ··ä¹±ï¼åæ¥æ们éæ°è§å®äºä¸ä¸ï¼è§£å³äºè¿äºé®é¢ï¼
4 ç¨åºç串èæ们éåäºå¾ªç¯æ§å¶ä¸éæ©ç»æç¸ç»åçç»æå¾å¥½å°è§£å³äºç³»ç»é¿æ¶é´è¿è¡å循ç¯æ§è¡å½ä»¤çé®é¢ï¼ä½¿æ¼ç¤ºç³»ç»ç°å®åã
äºãæµè¯ç»æï¼
1ã å¨DOSç¶æä¸ï¼2ã æ§è¡library.exeæ件ï¼3ã è¿å
¥ç³»ç»æä½çé¢ã
4ã éæ©Manage of Booké项ï¼5ã è¿è¡å¾ä¹¦åºç®¡çæä½ãè¿å
¥åæ ¹æ®æ示信æ¯å¯è¿è¡ï¼1ãæ°ä¹¦å
¥åº2ãå é¤æ§ä¹¦3ãæ¥è¯¢åºåå¾ä¹¦æä½ã
éæ©1ï¼æ ¹æ®ç¸åºæ示信æ¯è¾å
¥ä¹¦å·ã书åãä½è
ãåºçåä½ãä»·æ ¼ã页æ°ï¼å³å¯è¿è¡å
¥åºæä½ï¼å¹¶è¾åºåºå
å¾ä¹¦çèµæååºåå¾ä¹¦åéãææ示æä½å¯è¿è¡å¾ªç¯æä½ã
è¾å
¥æ°æ®å¦ä¸ï¼è¿è¡ä½ç§æä½ï¼1ãæ°ä¹¦å
¥åº2ãå é¤æ§ä¹¦3ãæ¥è¯¢åºåå¾ä¹¦1
æ¯å¦è¿è¡æ°ä¹¦å
¥åºæä½ï¼1ãæ¯2ãå¦1
请è¾å
¥ä¹¦å·ï¼00001
请è¾å
¥ä¹¦åï¼Shujujiegou
请è¾å
¥ä½è
ï¼YanHuiming
请è¾å
¥åºç社ï¼TSINGHUACOMPUTER
请è¾å
¥ä»·æ ¼ï¼18
请è¾å
¥é¡µæ°ï¼216
æ¯å¦ç»§ç»è¿è¡æ°ä¹¦å
¥åºæä½ï¼1ãæ¯2ãå¦ 1
请è¾å
¥ä¹¦å·ï¼00003
请è¾å
¥ä¹¦åï¼Shujujiegotiji
请è¾å
¥ä½è
ï¼YanHuiming
请è¾å
¥åºç社ï¼TSINGHUACOMPUTER
请è¾å
¥ä»·æ ¼ï¼16
请è¾å
¥é¡µæ°ï¼256
æ¯å¦ç»§ç»è¿è¡æ°ä¹¦å
¥åºæä½ï¼1ãæ¯2ãå¦ 1
请è¾å
¥ä¹¦å·ï¼00002
请è¾å
¥ä¹¦åï¼Clanuage
请è¾å
¥ä½è
ï¼TanHaoqiang
请è¾å
¥åºç社ï¼TSINGHUACOMPUTER
请è¾å
¥ä»·æ ¼ï¼19
请è¾å
¥é¡µæ°ï¼398
æ¯å¦ç»§ç»è¿è¡æ°ä¹¦å
¥åºæä½ï¼1ãæ¯2ãå¦ 1
请è¾å
¥ä¹¦å·ï¼00004
请è¾å
¥ä¹¦åï¼CollageEnglish
请è¾å
¥ä½è
ï¼MrWilliam
请è¾å
¥åºç社ï¼ZHEJIANGCOLLAGE
请è¾å
¥ä»·æ ¼ï¼49
请è¾å
¥é¡µæ°ï¼582
æ¯å¦ç»§ç»è¿è¡æ°ä¹¦å
¥åºæä½ï¼1ãæ¯2ãå¦ 2
æ¯å¦ç»§ç»è¿è¡å¾ä¹¦åºç®¡çæä½ï¼1ãæ¯2ãå¦ 2
è¿è¡ä½ç§æä½ï¼1ãæ°ä¹¦å
¥åº2ãå é¤æ§ä¹¦3ãæ¥è¯¢åºåå¾ä¹¦ 3
以ä¸ä¸ºåºåå¾ä¹¦ï¼
书å·ï¼00001书åï¼Shujujiegou ä½è
ï¼YanHuimingåºç社ï¼TSINGHUACOMPUTERä»·æ ¼ï¼18 页æ°ï¼216
书å·ï¼00002 书åï¼Clanuageä½è
ï¼TanHaoqiang åºç社ï¼TSINGHUACOMPUTER ä»·æ ¼ï¼19 页æ°ï¼398
书å·ï¼00003 书åï¼Shujujiegoutiji ä½è
ï¼YanHuiming åºç社ï¼TSINGHUACOMPUTER ä»·æ ¼ï¼16 页æ°ï¼256
书å·ï¼00004书åï¼CollageEnglish ä½è
ï¼MrWilliam åºç社ï¼ZHEJIANGCOLLAGE ä»·æ ¼ï¼49 页æ°ï¼582
å é¤æä½é·åã
éæ©2ï¼æ ¹æ®ç¸åºæ示信æ¯è¾å
¥è¦å é¤å¾ä¹¦ç书å·ï¼å³å¯è¿è¡å é¤æä½ï¼å¹¶è¾åºåºå
å¾ä¹¦çèµæååºåå¾ä¹¦éãææ示æä½å¯è¿è¡å¾ªç¯æä½ã
éæ© 3ï¼è¾åºåºå
å¾ä¹¦çèµæååºå
å¾ä¹¦åéã*/
éåçé¢ éæ© manage of borrower é项
éåçé¢ éæ©borroweré项ï¼åºç°å¦ä¸æ示ï¼
请è¾å
¥å书è¯å·ï¼00012
请è¾å
¥è¦å书书å·ï¼00002ï¼
å书æä½æåï¼
æ¯å¦ç»§ç»è¿è¡å书æä½ï¼1 æ¯/2 å¦ 1
请è¾å
¥å书è¯å·ï¼001100
对ä¸èµ·ï¼è¯¥å书è¯å·ä¸åå¨
å书æä½å¤±è´¥ï¼
æ¯å¦ç»§ç»è¿è¡å书æä½ï¼1 æ¯//2å¦ 2
éåçé¢ éæ© Return book é项ï¼åºç°å¦ä¸æ示ï¼
请è¾å
¥è¿ä¹¦è
å书è¯å·ï¼00012
è¿ä¹¦æä½æåï¼
æ¯å¦ç»§ç»è¿è¡è¿ä¹¦æä½ï¼1æ¯/2 å¦ 1
请è¾å
¥è¿ä¹¦è
å书è¯å·ï¼001100
对ä¸èµ·å书è¯å·ä¸åå¨ï¼
è¿ä¹¦æä½å¤±è´¥ï¼
éåçé¢ éæ© search éé¡¹ï¼ åºç°ä»¥ä¸æ示ï¼
请éæ©ä½ è¦æ¥æ¾çæ¹å¼:
1,æ书åæ¥æ¾;
2,æä½è
æ¥æ¾;
3,æåºçåä½æ¥æ¾;
4,æåé
è
æ¥æ¾;
5,èªå®ä¹æ¥æ¾ï¼
6,éåºã;
éæ©1
请è¾å
¥æ¨æ³è¦æ¥æ¾ç书å,æå车ç»æ.
Shujujiegou
该书ç书å·ä¸º:00001
该书ç书å为:Shujujiegou
该书åºçåä½ä¸º: TSINGHUACOMPUTER
该书ä½è
为:Yanhuiming
该书页æ°ä¸ºï¼216
该书å®ä»·ä¸ºï¼18
该书å½ååæ°ä¸º:1
å¦æåºå
没æè¿æ¬ä¹¦åè¾åº
对ä¸èµ·ï¼åºå
没æå¾ä¹¦!
æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦ 2
æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦ 1
以ä¸æä½é·åã
æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦ 2
éåçé¢ã
å
ãç¨æ·ä½¿ç¨è¯´æ书ï¼
é¦å
欢è¿æ¨ä½¿ç¨æ¬å¾ä¹¦é¦ç®¡çç³»ç»ãæ¬ç³»ç»ä¸»è¦é¢åä¸ãå°åçå¾ä¹¦é¦ç管ç人åã
è¿è¡ä¸»ç¨åºåï¼æ¨å°è½å¤çå°ä¸ä¸ªå¸¦æ欢è¿çé¢ççªå£ï¼ä¸é¢ææ¨æè½è¿è¡çæä½ï¼æ¨å¯ä»¥å¨è¿ééæ©ã
å½éä¸ç¸åºèåæ¡çæ¶åï¼æåä¼ç±ç½è²å为èè²ï¼æä¸Enterï¼å车é®ï¼å¼å§è¿è¡æä½ã
1 æ¬ç¨åºçè¿è¡ç¯å¢ä¸ºçº¯dosæä½ç³»ç»,æ§è¡æ件为library.exe.
2 å书:å¨èåä¸éæ©Borrow项ï¼æä¸Enterï¼å车é®ï¼è¿è¡å书æä½ãè¿å
¥åæç
§æ示æä½,
以Enter(å车é®)ä½ä¸ºç»æã
3 è¿ä¹¦ï¼å¨èåä¸éæ©Return项ï¼æä¸Enterï¼å车é®ï¼è¿è¡è¿ä¹¦æä½ã
4 æ¥è¯¢ï¼å¨èåä¸éæ©Search项ï¼æä¸Enterï¼å车é®ï¼è¿è¡æ¥æ¾æä½ã
5 å¾ä¹¦ç®¡çï¼å¨èåä¸éæ©Manage of book项ï¼æä¸Enterï¼å车é®ï¼è¿è¡ä¹¦åºæä½ã
ææ示æä½å¯è¿è¡å¾ªç¯æä½ã
5ãåé
è
管çï¼å¨èåä¸éæ©Manage of borrow项ï¼æä¸Enterï¼å车é®ï¼è¿è¡åé
è
èµæåºæä½ã
6ãéåºï¼å¨èåä¸éæ©Exit项ï¼æä¸Enterï¼å车é®ï¼éåºæ¬ç³»ç»ãå¦å¤æ¨å¯ä»¥å¨ä»»ä½å¾å½¢çé¢ä¸æALT_Xé®æESCé®éåºç³»ç»ã
ï¼éï¼æºç¨åºï¼
struct booktype
{
int booknumber; /*书å·*/
char bookname[20]; /*书å*/
char auther[20]; /*ä½è
*/
char press[50]; /*åºçåä½*/
int price; /*å®ä»·*/
int pagenumber; /*页æ°*/
int nownumber; /*å½ååæ°*/
time_t borrowtime; /*å书æ¶é´*/
time_t returntime; /*è¿ä¹¦æ¶é´*/
char borrowernum; /*å书人è¯å·*/
struct booktype *next;
} *g_book_list;
struct borrowertype
{
int cardnumber; /*å书è¯å·*/
char name[20]; /*å§å*/
char sex[10]; /*æ§å«*/
char tel[10]; /*èç³»çµè¯*/
char unit[80]; /*å·¥ä½åä½*/
int lendnumber; /*å书æ°ç®*/
int booknumber; /*æå书å·*/
struct borrowertype *next;
struct borrowertype *prev;
} *g_borrower_list;
int m;
struct k
{ int number;
char name[16];
struct k *new;
} k;
void print(head)/*è¾åºåºåèµæ*/
struct booktype *head;
{struct booktype *p;
printf("以ä¸ä¸ºåºåå¾ä¹¦ï¼\n");
p=head;
if(head!=NULL)
{do
{printf("书å·:%d",p->booknumber);
printf("书å:%s",p->bookname);
printf("ä½è
:%s",p->auther);
printf("åºçåä½:%s",p->press);
printf("ä»·æ ¼:%d",p->price);
printf("页æ°:%d\n",p->pagenumber);
p=p->next;
}while (p!=NULL);
}
else printf("åºå
没æå¾ä¹¦!\n");
}
struct booktype *del(head,num)/*å é¤æ§ä¹¦*/
long num;
struct booktype *head;
{struct booktype *p1,*p2;
if(head==NULL)
{printf("åºå
没æå¾ä¹¦,æ æ³è¿è¡å é¤æä½!\n");
goto end;
}
p1=head;
while(num!=p1->booknumber&&p1->next!=NULL)
{p2=p1;
p1=p1->next;
}
if(num==p1->booknumber)
{if(p1==head)
head=p1->next;
else
{p2->next=p1->next;
m=m-1;
}
}
else
printf("åºä¸æ²¡æ该å¾ä¹¦!\n");
end:
return(head);
}
struct booktype *insert(head,newbook)/*æ°ä¹¦å
¥åºæä½*/
struct booktype *newbook,*head;
{struct booktype *p0,*p1,*p2;
p1=head;
p0=newbook;
if(head==NULL)
{head=p0;p0->next=NULL;}
else
{while((p0->booknumber>p1->booknumber)&&(p1->next!=NULL))
{p2=p1;p1=p1->next;}
if(p0->booknumber<p1->booknumber)
{if(head==p1)
head=p0;
else
{p2->next=p0;p0->next=p1;}}
else
{p1->next=p0;p0->next=NULL;}}
m=m+1;
return(head);
}
kucaozuo (head) /*书åºç®¡ç*/
struct booktype *head;
{struct booktype *book;
long del_num;
int u,v,w,x,y,z;
head=NULL;
do
{printf("è¿è¡ä½ç§æä½?1.æ°ä¹¦å
¥åº2.æ§ä¹¦å é¤3.æ¥è¯¢åºå
å¾ä¹¦\n");
scanf("%d",&v);
if(v==1)
{printf("æ¯å¦è¿è¡æ°ä¹¦å
¥åºæä½?1.æ¯2.å¦\n");
scanf("%d",&w);
if(w==1)
{do
{book=(struct booktype *)malloc(LEN);
printf("请è¾å
¥æ°ä¹¦æ°æ®:\n");
printf("请è¾å
¥ä¹¦å·:");
scanf("%d",&book->booknumber);
printf("请è¾å
¥ä¹¦å:");
scanf("%s",&book->bookname);
printf("请è¾å
¥ä½è
:");
scanf("%s",&book->auther);
printf("请è¾å
¥åºçåä½:");
scanf("%s",&book->press);
printf("请è¾å
¥å¾ä¹¦ä»·æ ¼:");
scanf("%d",&book->price);
printf("请è¾å
¥é¡µæ°:");
scanf("%d",&book->pagenumber);
head=insert(head,book);
print(head);
printf("æ¯å¦ç»§ç»è¿è¡æ°ä¹¦å
¥åºæä½?1.æ¯2.å¦\n");
scanf("%d",&x);
}while(x==1);
}
}
else
{if (v==2)
{printf("æ¯å¦è¿è¡å é¤æä½?1.æ¯2.å¦\n");
scanf("%d",&y);
if(y==1)
{do
{printf("请è¾å
¥è¦å é¤ç书å·:\n");
scanf("%ld",&del_num);
head=del(head,del_num);
print(head);
printf("æ¯å¦ç»§ç»è¿è¡å é¤æä½?1.æ¯2.å¦\n");
scanf("%d",&z);
}while(z==1);
}
}
else
{printf("åºå
å¾ä¹¦èµæ:\n");
print(head);
printf("åºå
å¾ä¹¦æ°ç®ä¸º:%d\n",m);
}
}
printf("æ¯å¦ç»§ç»è¿è¡ä¹¦åºç®¡çæä½?1.æ¯2.å¦\n");
scanf("%d",&u);
}while(u==1);
return(head);
}
/************************************************************************************/
/************************************************************************************/
void look_for_name ()
{ struct booktype *head,*p;
int i,n=1,e;
do
{char borrow_name[20];
printf ("请è¾å
¥æ¨æ³è¦æ¥æ¾ç书å,æå车ç»æ.");
scanf ("%s",borrow_name);
p=head;
if (!head)
{do
{ if (0==strcmp (p->bookname,borrow_name))
{ i=1;
printf ("该书ç书å·ä¸º:%d\n",p->booknumber);
printf ("该书ç书å为:%s\n",p->bookname[20]);
printf ("该书åºçåä½ä¸º:%s\n",p->press[50]);
printf ("该书ä½è
为:%s\n",p->auther[20]);
printf ("该书页æ°ä¸º:%d\n",p->pagenumber);
printf ("该书å®ä»·ä¸ºï¼%d\n",p->price);
printf ("该书å½ååæ°ä¸º:%d\n",p->nownumber);
if (p->nownumber!=0)
printf ("æ¬ä¹¦å·²è¢«ååº,å书è
è¯å·ä¸º:%d",p->borrowernum);
else printf ("æ¬ä¹¦æªè¢«ååº.\n");
}
p=p->next;
}while(!p);
}
else printf ("对ä¸èµ·ï¼åºå
没æå¾ä¹¦!\n");
if (i!=1)
printf ("对ä¸èµ·,没ææ¨è¦æ¥æ¾çå¾ä¹¦.\n");
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}while(e==1);
}
void look_for_writer ()
{ struct booktype *head,*p;
int e,i,n=1;
char borrow_writer[16];
do
{printf ("请è¾å
¥æ¨æ³è¦æ¥æ¾ç书çä½è
,æå车ç»æ.\n");
scanf ("%s",borrow_writer[16]);
p=head;
if (!head)
{do
{if(0==strcmp (p->auther[20],borrow_writer[16]))
{i=1;
printf ("该书ç书å·ä¸º:%d\n",p->booknumber);
printf ("该书ç书å为:%s\n",p->bookname[20]);
printf ("该书åºçåä½ä¸º:%s\n",p->press[50]);
printf ("该书ä½è
为:%s\n",p->auther[20]);
printf ("该书页æ°ä¸º:%d\n",p->pagenumber);
printf ("该书å®ä»·ä¸ºï¼%d\n",p->price);
printf ("该书å½ååæ°ä¸º:%d\n",p->nownumber);
if (p->nownumber!=0)
printf ("æ¬ä¹¦å·²è¢«ååº,å书è
è¯å·ä¸º:%d",p->borrowernum);
else printf ("æ¬ä¹¦æªè¢«ååº.\n");
}
p=p->next;
}while(!p);
}
else printf ("对ä¸èµ·ï¼åºå
没æå¾ä¹¦!\n");
if (i!=1)
printf ("对ä¸èµ·,没ææ¨è¦æ¥æ¾çå¾ä¹¦.\n");
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}while(e==1);
}
void look_for_press()
{ int i=0,e;
struct booktype *head, *p;
char borrow_press[40];
do
{printf ("请è¾å
¥æ¨æ³è¦æ¥æ¾ç书çåºçåä½,æå车ç»æ.\n");
scanf ("%s",borrow_press);
p=head;
if (!head)
{ do
{ if (0==strcmp (p->press,borrow_press))
{i=1;
printf ("该书ç书å·ä¸º:%d\n",p->booknumber);
printf ("该书ç书å为:%s\n",p->bookname[20]);
printf ("该书åºçåä½ä¸º:%s\n",p->press[50]);
printf ("该书ä½è
为:%s\n",p->auther[20]);
printf ("该书页æ°ä¸º:%d\n",p->pagenumber);
printf ("该书å®ä»·ä¸ºï¼%d\n",p->price);
printf ("该书å½ååæ°ä¸º:%d\n",p->nownumber);
if (p->nownumber!=0)
printf ("æ¬ä¹¦å·²è¢«ååº,å书è
è¯å·ä¸º:%d",p->borrowernum);
else printf ("æ¬ä¹¦æªè¢«ååº.\n");
}
p=p->next;
}while(!p);
}
else printf ("对ä¸èµ·ï¼åºå
没æå¾ä¹¦!\n");
if (i!=1)
printf ("对ä¸èµ·,没ææ¨è¦æ¥æ¾çå¾ä¹¦.\n");
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}while(e==1);
}
void look_for_number()
{ int i,e;
struct booktype *head,*p;
int borrow_nomber;
do
{printf ("请è¾å
¥æ¨è¦æ¥æ¾ç书ç书å·,æå车ç»æ.\n");
scanf ("%d",&borrow_nomber);
p=head;
if (!head)
{do
{ if (p->booknumber==borrow_nomber)
{ i=1;
printf ("该书ç书å·ä¸º:%d\n",p->booknumber);
printf ("该书ç书å为:%s\n",p->bookname[20]);
printf ("该书åºçåä½ä¸º:%s\n",p->press[50]);
printf ("该书ä½è
为:%s\n",p->auther[20]);
printf ("该书页æ°ä¸º:%d\n",p->pagenumber);
printf ("该书å®ä»·ä¸ºï¼%d\n",p->price);
printf ("该书å½ååæ°ä¸º:%d\n",p->nownumber);
if (p->nownumber!=0)
printf ("æ¬ä¹¦å·²è¢«ååº,å书è
è¯å·ä¸º:%d",p->borrowernum);
else printf ("æ¬ä¹¦æªè¢«ååº.\n");
}
p=p->next;
}while(!p);
}
else printf ("对ä¸èµ·ï¼åºå
没æå¾ä¹¦!\n");
if (i!=1)
printf ("对ä¸èµ·,没ææ¨è¦æ¥æ¾çå¾ä¹¦.\n");
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}while(e==1);
}
void look_for_borrower ()
{void look_card_num ();
void look_card_name ();
char borrower_name[20];
int n,d,e;
do
{printf ("请æ¨éæ©æ¨è¦æ¥æ¾çæ¹å¼:1,æå书è
çå¡å·\n;2æå书è
çåå;\n;3ï¼éåº\n");
scanf ("%d",&n);
if (n==1)
look_card_num ();
else if (n==2)
look_card_name ();
else if (n==3)
exit (0);
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}while(e==1);
}
void look_card_num ()
{ struct booktype *head, *p;
struct borrowertype *card,*hed;
int m,e;
do
{printf ("请è¾å
¥æ¨è¦æ¥æ¾çå¡çå¡å·.\n");
scanf ("%d",&m);
card=hed;
if (!hed)
{do
{ if (card->cardnumber==m)
{ printf ("æ¤å¡å¡å·ä¸º:%d\n",card->cardnumber);
printf ("æ¤å¡ææè
çå§å为:%s\n",card->name[20]);
printf ("æ¤å¡ææè
çæ§å«ä¸º:%s\n",card->sex[10]);
printf ("æ¤å¡ææè
çèç³»çµè¯ä¸º:%d\n",card->tel[10]);
printf ("æ¤å¡ææè
çå·¥ä½åä½ä¸º:%d\n",card->unit[80]);
p=head;
if (!head)
{do
{ if (card->cardnumber==p->borrowernum)
{printf ("æ¤å¡å·²ç»åé
äºå¾ä¹¦\n");
printf ("该书ç书å·ä¸º:%d\n",p->booknumber);
printf ("该书ç书å为:%s\n",p->bookname[20]);
printf ("该书åºçåä½ä¸º:%s\n",p->press[50]);
printf ("该书ä½è
为:%s\n",p->auther[20]);
printf ("该书页æ°ä¸º:%d\n",p->pagenumber);
printf ("该书å®ä»·ä¸ºï¼%d\n",p->price);
printf ("该书å½ååæ°ä¸º:%d\n",p->nownumber);
}
p=p->next;
}while(!p);
}
printf ("æ¤å¡ä¸åå¨.");
card=card->new;}
else printf ("æ¤å¡å·ä¸åå¨.\n");
}while(!card);
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}
}while(e==1);
}
void look_card_name ()
{int e;
struct booktype *p,*head;
struct borrowertype *card,*had;
char borrower_name[16];
do
{printf ("请è¾å
¥æ¨è¦æ¥æ¾çå¡çææè
çå§å.\n");
scanf ("%s",borrower_name[16]);
card=had;
if (!had)
{do
{ if (0==strcmp (card->name,borrower_name[16]))
{ printf ("æ¤å¡å¡å·ä¸º:%d\n",card->cardnumber);
printf ("æ¤å¡ææè
çå§å为:%s\n",card->name[20]);
printf ("æ¤å¡ææè
çæ§å«ä¸º:%s\n",card->sex[10]);
printf ("æ¤å¡ææè
çèç³»çµè¯ä¸º:%d\n",card->tel[10]);
printf ("æ¤å¡ææè
çå·¥ä½åä½ä¸º:%d\n",card->unit[80]);
p=head;
if (!head)
{do
{if (card->cardnumber==p->borrowernum)
{printf ("æ¤å¡å·²ç»åé
äºå¾ä¹¦\n");
printf ("该书ç书å·ä¸º:%d\n",p->booknumber);
printf ("该书ç书å为:%s\n",p->bookname[20]);
printf ("该书åºçåä½ä¸º:%s\n",p->press[50]);
printf ("该书ä½è
为:%s\n",p->auther[20]);
printf ("该书页æ°ä¸º:%d\n",p->pagenumber);
printf ("该书å®ä»·ä¸ºï¼%d\n",p->price);
printf ("该书å½ååæ°ä¸º:%d\n",p->nownumber);
}
p=p->next;
}while(!p);
}
}
card=card->new;
}while(!card);
}
printf("æ¯å¦ç»§ç»è¿è¡æ¥æ¾æä½ï¼1ãæ¯,2ãå¦\n");
scanf("%d",&e);
}while(e==1);
}
void look_for_word()
{ int a,j,m,i,n=1,e;
struct booktype *p;
struct booktype *head;
char word[20];
do
{printf ("请è¾å
¥ä¹¦åå
³é®å,æå车ç»æ.\n");
scanf ("%s",word[20]);
a=0;
do
{ a=a+1;
}
while (!word[a]);
p=hea
温馨提示:内容为网友见解,仅供参考