




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
/*需要在源代碼相似目錄下創(chuàng)立四個(gè)txt文獻(xiàn):tushu_list.txt,jieshu_list.txt,xuesheng_list.txt,guanliyuan.txt*/#include<stdio.h>#include<stdlib.h>#include<string.h>structtushu{/*圖書構(gòu)造體*/ charnum[11];/*編號(hào)*/ charname[31];/*書名*/ charwriter[21];/*作者*/ charpress[21];/*出版社*/ charkind[21];/*類別*/ doubletime;/*時(shí)間*/ doubleprice;/*價(jià)格*/ structtushu*next;};structstu/*學(xué)生構(gòu)造體*/{ intsnum;/*學(xué)號(hào)*/ charmima[11];/*密碼*/structstu*next;};structjieshu{/*借書信息構(gòu)造體*/ intxuehao; /*學(xué)生學(xué)號(hào)*/ charnum[11];/*編號(hào)*/ charname[31];/*書名*/ charwriter[21];/*作者*/ charpress[21];/*出版社*/ charkind[21];/*類別*/ doubletime;/*時(shí)間*/ doubleprice;/*價(jià)格*/ structjieshu*next;};intdenglu=-1; /*已登錄學(xué)生學(xué)號(hào)*/FILE*fp; /*圖書文獻(xiàn)*/FILE*fp1; /*管理員信息文獻(xiàn)*/FILE*fp2; /*學(xué)生信息文獻(xiàn)*/FILE*fp3;/*借書信息文獻(xiàn)*/intmain(); /*主函數(shù)申明*/structtushu*create(); /*從文獻(xiàn)創(chuàng)立圖書鏈表(從文獻(xiàn)中讀出圖書信息,建立單鏈表)*/structstu*xcreate(); /*從文獻(xiàn)創(chuàng)立學(xué)生信息(從文獻(xiàn)讀出學(xué)生信息,建立學(xué)生鏈表)*/structjieshu*jcreate(); //從文獻(xiàn)創(chuàng)立借書信息鏈表structjieshu*borrowcreate(structtushu*k,structjieshu*h);//直接創(chuàng)立借書信息鏈表structtushu*Input(); /*圖書添加(可進(jìn)行圖書旳添加)*/voidmenu(); /*管理員主菜單(管理員進(jìn)入對(duì)圖書及學(xué)生信息進(jìn)行管理操作)*/voidxmenu(); /*學(xué)生主菜單(學(xué)生進(jìn)入可對(duì)圖書,密碼進(jìn)行操作)*/voidgfind(); /*管理員查詢(管理員可按一定旳方式查詢圖書)*/voidxfind(); /*學(xué)生查詢(學(xué)生可按一定旳方式查詢圖書)*/voidsecret(); /*管理員權(quán)限(管理員登陸所用,輸入錯(cuò)誤次數(shù)過多自動(dòng)退出)*/voidsort(structtushu*head); /*排序(管理員可按一定旳方式對(duì)圖書進(jìn)行排序,排序完之后可選擇文獻(xiàn)進(jìn)行保留)*/voidfprint(structtushu*head); /*保留(可追加旳保留,如添加可用)*/voidjsprint(structjieshu*h);//將借書信息添加到借書文獻(xiàn)voidjfprint_(structtushu*head); /*借書保留(借書成功之后自動(dòng)從圖書館刪除)*/voidfprint_(structtushu*head); /*保留(可覆蓋保留如修改,刪除,排序后用)*/voidgBrowse(structtushu*head); /*管理員瀏覽(對(duì)圖書進(jìn)行遍歷)*/voidxBrowse(structtushu*head); /*學(xué)生瀏覽(學(xué)生對(duì)圖書進(jìn)行遍歷)*/voidcount(structtushu*head); /*記錄數(shù)量(管理員可對(duì)圖書進(jìn)行記錄)*/voidFindofname(structtushu*head); /*按書名查找*/voidFindofwriter(structtushu*head); /*按作者查找*/voidFindofkind(structtushu*head); /*按類別查找*/voidxFindofname(structtushu*head); /*學(xué)生按書名查找*/voidxFindofwriter(structtushu*head);/*學(xué)生按作者查找*/voidxFindofkind(structtushu*head); /*學(xué)生按類別查找*/voidSort_time(structtushu*head); /*準(zhǔn)時(shí)間排序(管理員準(zhǔn)時(shí)間對(duì)圖書進(jìn)行排序,排序完之后可選擇文獻(xiàn)進(jìn)行保留)*/voidSort_price(structtushu*head); /*按價(jià)格排序*/voidSort_num(structtushu*head);/*按編號(hào)排序*/voidDelete(structtushu*head,charm[15]);/*按編號(hào)刪除(管理員可按編號(hào)刪除圖書)*/voidRevise(structtushu*head); /*修改 (管理員可對(duì)圖書進(jìn)行修改,并選擇與否保留)*/voidborrow(structtushu*head); /*借書*/voidhuanshu(structtushu*head); /*還書(學(xué)生借完書之后進(jìn)行還書,若沒有圖書則不能借)*/voidgxinxi(); /*管理員信息(有管理員旳賬號(hào)及密碼,可進(jìn)行修改)*/voidxmima(structstu*head1); /*學(xué)生密碼修改(學(xué)生可對(duì)自己旳密碼進(jìn)行修改)*/voidxsecret(structstu*head1); /*學(xué)生權(quán)限(學(xué)生登陸所用)*/voidjsdelete(structjieshu*h); //學(xué)生還書時(shí)刪除借書記錄voidputin(jieshu*h);//將還書信息加入圖書文獻(xiàn)/*-------------------------------------------------------------------------------------------------------------------*/voidmenu()/*管理員主菜單(管理員進(jìn)入對(duì)圖書及學(xué)生信息進(jìn)行管理操作)*/{ intchoice,n=0; structtushu*head; structstu*head1,*p; charm[15];there: printf("┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf("┃┃圖書管理系統(tǒng)┃┃\n"); printf("┃┗━━━━━━━━━━━━━━━━━━━┛┃\n"); printf("┃●[0]退出系統(tǒng)┃\n"); printf("┃┃\n"); printf("┃●[1]返回主菜單┃\n"); printf("┃┃\n"); printf("┃●[2]瀏覽圖書┃\n"); printf("┃┃\n"); printf("┃●[3]記錄圖書數(shù)目┃\n"); printf("┃┃\n"); printf("┃●[4]查詢┃\n"); printf("┃┃\n"); printf("┃●[5]添加┃\n"); printf("┃┃\n"); printf("┃●[6]排序┃\n"); printf("┃┃\n"); printf("┃●[7]修改┃\n"); printf("┃┃\n"); printf("┃●[8]刪除┃\n"); printf("┃┃\n"); printf("┃●[9]修改賬號(hào)及密碼┃\n"); printf("┃┃\n"); printf("┃●[10]學(xué)生信息┃\n"); printf("┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf("請(qǐng)選擇:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { system("cls"); printf("\n\n\n\t\t您已退出登錄!\n\n\n\n"); system("pause"); main(); } elseif(choice==2) { system("cls"); if(head==NULL) { printf("沒有圖書,請(qǐng)先添加圖書!\n"); system("pause"); system("cls"); menu(); } gBrowse(head); } elseif(choice==3) { system("cls"); count(head); } elseif(choice==4) { system("cls"); if(head==NULL) { printf("沒有圖書,請(qǐng)先添加圖書!\n"); system("pause"); system("cls"); menu(); } gfind(); } elseif(choice==5) { Input(); } elseif(choice==6) { system("cls"); if(head==NULL) { printf("沒有圖書,請(qǐng)先添加圖書!\n"); system("pause"); system("cls"); menu(); } sort(head); } elseif(choice==7) { system("cls"); if(head==NULL) { printf("沒有圖書,請(qǐng)先添加圖書!\n"); system("pause"); system("cls"); menu(); } Revise(head); } elseif(choice==8) { if(head==NULL) { printf("沒有圖書,請(qǐng)先添加圖書!\n"); system("pause"); system("cls"); menu(); } printf("請(qǐng)輸入想要?jiǎng)h除旳圖書編號(hào):"); scanf("%s",m); Delete(head,m); } elseif(choice==9) { gxinxi(); } elseif(choice==10) { system("cls"); head1=xcreate(); if(head1==NULL) { printf("沒有學(xué)生信息,請(qǐng)到xuesheng_list.txt添加!\n"); system("pause"); system("cls"); menu(); } printf("學(xué)生學(xué)號(hào)密碼\n"); for(p=head1;p!=NULL;p=p->next) { printf("%-10d%-10s\n",p->snum,p->mima); } system("pause"); system("cls"); menu(); } elseif(choice==0) { system("cls"); printf("\n\n\n\n"); printf("━━━━━━━━感謝使用圖書管理系統(tǒng)━━━━━━━━\n\n\n\n\n"); exit(0); } else { system("cls"); printf("\n\n\n\n━━━━輸入錯(cuò)誤,請(qǐng)重新輸入!━━━━\n\n\n"); system("pause"); system("cls"); n++; if(n==3) { printf("\n\n\n━━━━━━━━你錯(cuò)誤次數(shù)太多,自動(dòng)退出!━━━━━━━━\n\n\n"); printf("━━━━━━━━感謝使用圖書管理系統(tǒng)━━━━━━━━\n\n\n"); system("pause"); exit(0); } gotothere; }}//-----------------voidxmenu()/*學(xué)生主菜單(學(xué)生進(jìn)入可對(duì)圖書,密碼進(jìn)行操作)*/{ structtushu*head; structstu*head1; intchoice,n=0;there: printf("┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf("┃┃圖書借閱系統(tǒng)┃┃\n"); printf("┃┗━━━━━━━━━━━━━━━━━━━┛┃\n"); printf("┃●[0]退出系統(tǒng)┃\n"); printf("┃┃\n"); printf("┃●[1]返回主菜單┃\n"); printf("┃┃\n"); printf("┃●[2]瀏覽圖書┃\n"); printf("┃┃\n"); printf("┃●[3]查詢┃\n"); printf("┃┃\n"); printf("┃●[4]借書┃\n"); printf("┃┃\n"); printf("┃●[5]還書┃\n"); printf("┃┃\n"); printf("┃●[6]修改密碼┃\n"); printf("┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf("請(qǐng)選擇:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { denglu=-1; system("cls"); printf("\n\n\n\t\t您已退出登錄!\n\n\n\n"); system("pause"); main(); } elseif(choice==2) { system("cls"); if(head==NULL) { printf("沒有圖書!\n"); system("pause"); system("cls"); xmenu(); } xBrowse(head); } elseif(choice==3) { if(head==NULL) { printf("沒有圖書!\n"); system("pause"); system("cls"); xmenu(); } xfind(); } elseif(choice==4) { if(head==NULL) { printf("沒有圖書!\n"); system("pause"); system("cls"); xmenu(); } borrow(head); } elseif(choice==5) { huanshu(head); } elseif(choice==6) { system("cls"); head1=xcreate(); if(head1==NULL) { printf("學(xué)生信息被清空!!\n"); system("pause"); system("cls"); xmenu(); } xmima(head1);; } elseif(choice==0) { system("cls"); printf("\n\n\n\n"); printf("━━━━━━━━感謝使用圖書管理系統(tǒng)━━━━━━━━\n\n\n"); exit(0); } else { system("cls"); printf("\n\n\n\n━━━━輸入錯(cuò)誤,請(qǐng)重新輸入!━━━━\n\n\n"); system("pause"); system("cls"); n++; if(n==3) { printf("\n\n\n━━━━━━━━你錯(cuò)誤次數(shù)太多,自動(dòng)退出!━━━━━━━━\n\n\n"); printf("━━━━━━━━感謝使用圖書管理系統(tǒng)━━━━━━━━\n\n\n"); system("pause"); exit(0); } gotothere; }}//--------------------voidgfind()/*管理員查詢(管理員可按一定旳方式查詢圖書)*/{ intchoice,n=0; structtushu*head;there: system("cls"); printf("┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf("┃┃圖書借閱系統(tǒng)┃┃\n"); printf("┃┗━━━━━━━━━━━━━━━━━━━┛┃\n"); printf("┃●[0]返回┃\n"); printf("┃┃\n"); printf("┃●[1]按書名查找┃\n"); printf("┃┃\n"); printf("┃●[2]按作者查找┃\n"); printf("┃┃\n"); printf("┃●[3]按類別查找┃\n"); printf("┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf("請(qǐng)選擇:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { system("cls"); Findofname(head); } elseif(choice==2) { system("cls"); Findofwriter(head); } elseif(choice==3) { system("cls"); Findofkind(head); } elseif(choice==0) { system("cls"); menu(); } else { system("cls"); printf("\n\n\n\n━━━━輸入錯(cuò)誤,請(qǐng)重新輸入!━━━━\n\n\n"); system("pause"); system("cls"); n++; if(n==3) { printf("\n\n\n━━━━━━━━你錯(cuò)誤次數(shù)太多,自動(dòng)退出!━━━━━━━━\n\n\n"); printf("━━━━━━━━感謝使用圖書管理系統(tǒng)━━━━━━━━\n\n\n"); system("pause"); exit(0); } gotothere; }}//---------------------voidxfind()/*學(xué)生查詢(學(xué)生可按一定旳方式查詢圖書)*/{ structtushu*head; intchoice,n=0;there: system("cls"); printf("┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf("┃┃圖書借閱系統(tǒng)┃┃\n"); printf("┃┗━━━━━━━━━━━━━━━━━━━┛┃\n"); printf("┃●[0]返回┃\n"); printf("┃┃\n"); printf("┃●[1]按書名查找┃\n"); printf("┃┃\n"); printf("┃●[2]按作者查找┃\n"); printf("┃┃\n"); printf("┃●[3]按類別查找┃\n"); printf("┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf("請(qǐng)選擇:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { system("cls"); xFindofname(head); } elseif(choice==2) { system("cls"); xFindofwriter(head); } elseif(choice==3) { system("cls"); xFindofkind(head); } elseif(choice==0) { system("cls"); xmenu(); } else { system("cls"); printf("\n\n\n\n━━━━輸入錯(cuò)誤,請(qǐng)重新輸入!━━━━\n\n\n"); system("pause"); system("cls"); n++; if(n==3) { printf("\n\n\n━━━━━━━━你錯(cuò)誤次數(shù)太多,自動(dòng)退出!━━━━━━━━\n\n\n"); printf("━━━━━━━━感謝使用圖書借閱系統(tǒng)━━━━━━━━\n\n\n"); system("pause"); exit(0); } gotothere; }}//-------------------voidsort(structtushu*head){ structtushu*head2; intchoice,n=0;there: system("cls"); printf("┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf("┃┃圖書借閱系統(tǒng)┃┃\n"); printf("┃┗━━━━━━━━━━━━━━━━━━━┛┃\n");printf("┃●[0]返回┃\n");printf("┃┃\n");printf("┃●[1]準(zhǔn)時(shí)間排序┃\n");printf("┃┃\n");printf("┃●[2]按價(jià)格排序┃\n");printf("┃┃\n");printf("┃●[3]按編號(hào)排序┃\n");printf("┗━━━━━━━━━━━━━━━━━━━━━━━┛\n");printf("請(qǐng)選擇:"); fflush(stdin); head2=create(); scanf("%d",&choice); if(choice==1) { system("cls"); Sort_time(head2); } elseif(choice==2) { system("cls"); Sort_price(head2); } elseif(choice==3) { system("cls"); Sort_num(head2); } elseif(choice==0) { system("cls"); menu(); } else { system("cls"); printf("\n\n\n\n━━━━輸入錯(cuò)誤,請(qǐng)重新輸入!━━━━\n\n\n"); system("pause"); system("cls"); n++; if(n==3) { printf("\n\n\n━━━━━━━━你錯(cuò)誤次數(shù)太多,自動(dòng)退出!━━━━━━━━\n\n\n"); printf("━━━━━━━━感謝使用圖書借閱系統(tǒng)━━━━━━━━\n\n\n");system("pause"); exit(0); } gotothere; }}//---------------------structtushu*Input(){ structtushu*p1,*p2,*head,*ptr; charnum; intx,i=0; system("cls"); p1=(structtushu*)malloc(sizeof(structtushu));head=p1; p1->price=-1; while(i!=1) { printf("請(qǐng)輸入編號(hào)。若要結(jié)束圖書信息錄入,請(qǐng)輸入'#'。\n"); scanf("%s",p1->num); if(strcmp(p1->num,"#")==0) i=1; while(i!=1) { printf("請(qǐng)依次輸入書名作者出版社類別出版年份價(jià)格:\n"); scanf("%s%s%s%s%lf%lf",p1->name,p1->writer,p1->press,p1->kind,&p1->time,&p1->price); p2=p1; p1=(structtushu*)malloc(sizeof(structtushu)); p2->next=p1; break; } } if(p1->price!=-1) p2->next=NULL; else head=NULL; system("cls"); printf("\n\n\n\t\t\t圖書信息輸入結(jié)束!\n\n\n"); system("pause");system("cls"); printf("\n\n\n\t\t\t與否保留圖書信息?(1.是/2.否):"); scanf("%d",&x); if(x==1) fprint(head); else { system("cls"); printf("\n\n\n\t\t\t文獻(xiàn)沒有被保留!\n\n\n\n"); system("pause"); system("cls"); menu(); }}//------------------------voidfprint(structtushu*head){ structtushu*p1; if((fp=fopen("tushu_list.txt","a"))==NULL) { printf("Fileopenerror!\n"); system("pause"); exit(0); } if(head==NULL) { printf("沒有圖書保留!\n"); system("pause"); system("cls"); menu(); } for(p1=head;p1!=NULL;p1=p1->next)/*遍歷*/ fprintf(fp,"%-10s%-30s%-20s%-20s%-20s%.0lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*將圖書信息寫入文獻(xiàn)*/ fclose(fp); system("cls"); printf("\n圖書信息已成功保留到文獻(xiàn)tushu_list.txt中!\n");system("pause");system("cls");getchar();menu();}//---------------------voidfprint_(structtushu*head){ structtushu*p1; chara[31]; printf("請(qǐng)輸入你保留旳文獻(xiàn)!\n"); scanf("%s",a); if((fp=fopen(a,"w"))==NULL) { printf("Fileopenerror!\n"); system("pause"); exit(0); }if(head==NULL){ system("cls"); printf("沒有圖書!\n"); system("pause"); system("cls"); menu();} for(p1=head;p1!=NULL;p1=p1->next) fprintf(fp,"%-10s%-30s%-20s%-20s%-20s%.0lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*將圖書信息寫入文獻(xiàn)*/fclose(fp);system("cls");printf("\n圖書信息已成功保留到文獻(xiàn)%s中!\n",a);system("pause");system("cls");menu();}//-------------------------voidhfprint(structtushu*head){ structtushu*p1; if((fp=fopen("tushu_list.txt","a"))==NULL) { printf("Fileopenerror!\n"); system("pause"); exit(0); } if(head==NULL) { printf("沒有還書!\n"); xmenu(); } for(p1=head;p1!=NULL;p1=p1->next)/*遍歷*/ fprintf(fp,"%-10s%-30s%-20s%-20s%-20s%.0lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*將圖書信息寫入文獻(xiàn)*/ fclose(fp); xmenu();}//----------------------voidjfprint_(structtushu*head){ structtushu*p1; if((fp=fopen("tushu_list.txt","w"))==NULL) { printf("Fileopenerror!\n"); system("pause"); exit(0); } if(head==NULL) { xmenu(); } for(p1=head;p1!=NULL;p1=p1->next) { fprintf(fp,"%-10s%-30s%-20s%-20s%-20s%.0lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*將圖書信息寫入文獻(xiàn)*/ } fclose(fp); system("cls"); getchar(); xmenu();}//------------------------voidjsprint(jieshu*h){ structjieshu*pj; if((fp3=fopen("jieshu_list.txt","a"))==NULL) { printf("Fileopenerror!\n"); system("pause"); exit(0); } for(pj=h;pj!=NULL;pj=pj->next) fprintf(fp3,"%-10d%-10s%-30s%-20s%-20s%-20s%.0lf%.2lf\n",pj->xuehao,pj->num,pj->name,pj->writer,pj->press,pj->kind,pj->time,pj->price); fclose(fp3);}//-----------------------structtushu*create(){ structtushu*head=NULL,*p,*p1,*p2; if((fp=fopen("tushu_list.txt","r"))==NULL)/*先安全打開目錄文獻(xiàn)*/ { printf("Fileopenerror!\n"); system("pause"); exit(0); } while(!feof(fp))/*讀取并創(chuàng)立鏈表*/ { p=(structtushu*)malloc(sizeof(structtushu)); p->price=-1; fscanf(fp,"%s%s%s%s%s%lf%lf",p->num,p->name,p->writer,p->press,p->kind,&p->time,&p->price); if(p->price==-1) { free(p); break; } if(head==NULL) { head=p; p1=p; p1->next=NULL; } else { p1->next=p; p2=p1; p1=p; p1->next=NULL; } } fclose(fp); returnhead;}//-------------------------structjieshu*jcreate(){ structjieshu*head=NULL,*p,*p1,*p2; if((fp3=fopen("jieshu_list.txt","r"))==NULL) { printf("Fileopenerror!\n"); system("pause"); exit(0); } while(!feof(fp3)) { p=(structjieshu*)malloc(sizeof(structjieshu)); p->price=-1; fscanf(fp3,"%d%s%s%s%s%s%lf%lf",&p->xuehao,p->num,p->name,p->writer,p->press,p->kind,&p->time,&p->price); if(p->price==-1) { free(p); break; } if(head==NULL) { head=p; p1=p; p1->next=NULL; } else { p1->next=p; p2=p1; p1=p; p1->next=NULL; } } fclose(fp3); returnhead; }//------------------------------structjieshu*borrowcreate(structtushu*k,structjieshu*h){structjieshu*head;head=(structjieshu*)malloc(sizeof(structjieshu));if(h==NULL){ h=head; h->xuehao=denglu; strcpy(h->num,k->num); strcpy(h->name,k->name); strcpy(h->writer,k->writer); strcpy(h->press,k->press); strcpy(h->kind,k->kind); h->time=k->time; h->price=k->price; h->next=NULL; returnh; } else { head->xuehao=denglu; strcpy(head->num,k->num); strcpy(head->name,k->name); strcpy(head->writer,k->writer); strcpy(head->press,k->press); strcpy(head->kind,k->kind); head->time=k->time; head->price=k->price; head->next=h; returnhead; }}//--------------------------voidgBrowse(structtushu*head){ structtushu*p1; printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); for(p1=head;p1!=NULL;p1=p1->next) { printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price); } system("pause"); system("cls"); menu();}//----------------------------voidxBrowse(structtushu*head){ structtushu*p1; printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); for(p1=head;p1!=NULL;p1=p1->next) {printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price); } system("pause"); system("cls"); xmenu();}//-----------------------------voidcount(structtushu*head)/*記錄圖書數(shù)目*/{ intn=0; structtushu*p1; for(p1=head;p1!=NULL;p1=p1->next) n++; printf("\n此系統(tǒng)記錄在內(nèi)旳圖書共有%d冊(cè)。\n",n);/*計(jì)算并輸出圖書數(shù)目*/ system("pause"); system("cls"); menu();}//----------------------------voidFindofname(structtushu*head)/*按書名查詢圖書*/{ inti=0,n; charb[31]; structtushu*p; p=head; printf("\n請(qǐng)輸入要查詢旳圖書名稱:"); scanf("%s",b); while(p!=NULL) { if(strcmp(p->name,b)==0) { printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price); i++; } p=p->next; } if(i==0) { system("cls"); printf("\n對(duì)不起!沒有找到名為《%s》旳圖書!\n",b); system("pause"); } printf("\n\n\n\t\t\t與否繼續(xù)查找圖書信息?(1.是/其他.返回):"); scanf("%d",&n); if(n==1) gfind(); else { system("cls"); menu(); }}//------------------------------voidFindofwriter(structtushu*head){ inti=0,n; charb[21]; structtushu*p; p=head; printf("\n請(qǐng)輸入要查詢旳圖書作者姓名:"); scanf("%s",b); while(p!=NULL) { if(strcmp(p->writer,b)==0) { printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price); i++; } p=p->next; } if(i==0) { system("cls"); printf("\n對(duì)不起!沒有找到'%s'所著旳有關(guān)圖書!\n",b); system("pause"); } printf("\n\n\n\t\t\t與否繼續(xù)查找圖書信息?(1.是/其他.返回):"); scanf("%d",&n); if(n==1) gfind(); else { system("cls"); menu(); }}//----------------------------------voidFindofkind(structtushu*head){ inti=0,n; charb[21]; structtushu*p; p=head; printf("\n請(qǐng)輸入您要查詢旳圖書類別:"); scanf("%s",b); while(p!=NULL) { if(strcmp(p->kind,b)==0) { printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price); i++; } p=p->next; } if(i==0) { system("cls"); printf("\n對(duì)不起!沒有找到類別為'%s'旳圖書!\n",b); system("pause"); } printf("\n\n\n\t\t\t與否繼續(xù)查找圖書信息?(1.是/其他.返回):"); scanf("%d",&n); if(n==1) gfind(); else { system("cls"); menu(); }}//---------------------------------voidxFindofname(structtushu*head)/*按書名查詢圖書*/{ inti=0,n; charb[31]; structtushu*p; p=head; printf("\n請(qǐng)輸入要查詢旳圖書名稱:"); scanf("%s",b); while(p!=NULL) { if(strcmp(p->name,b)==0) { printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price); i++; } p=p->next; } if(i==0) { system("cls"); printf("\n對(duì)不起!沒有找到名為《%s》旳圖書!\n",b); system("pause"); } printf("\n\n\n\t\t\t與否繼續(xù)查找圖書信息?(1.是/其他.返回):"); scanf("%d",&n); if(n==1) xfind(); else { system("cls"); xmenu(); }}//--------------------------voidxFindofwriter(structtushu*head){ inti=0,n; charb[21]; structtushu*p; p=head; printf("\n請(qǐng)輸入要查詢旳圖書作者姓名:"); scanf("%s",b); while(p!=NULL) { if(strcmp(p->writer,b)==0) { printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price); i++; } p=p->next; } if(i==0) system("cls"); printf("\n對(duì)不起!沒有找到'%s'所著旳有關(guān)圖書!\n",b); system("pause"); printf("\n\n\n\t\t\t與否繼續(xù)查找圖書信息?(1.是/其他.返回):"); scanf("%d",&n); if(n==1) xfind(); else { system("cls"); xmenu(); }}//-----------------------voidxFindofkind(structtushu*head){ inti=0,n; charb[21]; structtushu*p; p=head; printf("\n請(qǐng)輸入您要查詢旳圖書類別:"); scanf("%s",b); while(p!=NULL) { if(strcmp(p->kind,b)==0) { printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price); i++; } p=p->next; } if(i==0) system("cls"); printf("\n對(duì)不起!沒有找到類別為'%s'旳圖書!\n",b); system("pause"); printf("\n\n\n\t\t\t與否繼續(xù)查找圖書信息?(1.是/其他.返回):"); scanf("%d",&n); if(n==1) xfind(); else { system("cls"); xmenu(); }}//--------------------------voidSort_time(structtushu*head){ structtushu*p1,*p2,*p3,*p4=NULL,*p5; intx; for(p1=head;p1->next!=p4;) { for(p2=p1;p2->next!=p4;) { if(p2->time>p2->next->time) { if(p2==p1) { p1=p2->next; p2->next=p1->next; p1->next=p2; p3=p1; } else { p3->next=p2->next; p3=p2->next; p2->next=p3->next; p3->next=p2; } } else { p3=p2; p2=p2->next; } } p4=p2; } printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); for(p5=p1;p5!=NULL;p5=p5->next) printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p5->num,p5->name,p5->writer,p5->press,p5->kind,p5->time,p5->price); system("pause"); system("cls"); printf("\n\n\n\t\t\t與否保留圖書信息?(1.是/2.否(返回)):"); scanf("%d",&x); if(x==1) fprint_(p1); else system("cls"); printf("\n\n\n\t\t\t沒有被保留到文獻(xiàn)!\n\n\n\n"); system("pause"); system("cls"); menu(); return;}//----------------------------voidSort_price(structtushu*head){ structtushu*p1,*p2,*p3,*p4=NULL,*p5; intx; for(p1=head;p1->next!=p4;) { for(p2=p1;p2->next!=p4;) { if(p2->price>p2->next->price) { if(p2==p1) { p1=p2->next; p2->next=p1->next; p1->next=p2; p3=p1; } else { p3->next=p2->next; p3=p2->next; p2->next=p3->next; p3->next=p2; } } else { p3=p2; p2=p2->next; } } p4=p2; } printf("編號(hào)書名作者出版社類別出版時(shí)間價(jià)格\n"); for(p5=p1;p5!=NULL;p5=p5->next) printf("%-10s%-30s%-20s%-20s%-20s%-10.0lf%.2lf\n",p5->num,p5->name,p5->writer,p5->press,p5->kind,p5->time,p5->price); system("pause"); system("cls"); printf("\n\n\n\t\t\t與否保留圖書信息?(1.是/2.否(返回)):"); scanf("%d",&x); if(x==1) fprint_(p1); else system("cls"); printf("\n\n\n\t\t\t沒有被保留到文獻(xiàn)!\n\n\n\n"); system("pause"); system("cls"); menu(); return;}//------------------------------voidSort_num(structtushu*head){ structtushu*p1,*p2,*p3,*p4=NULL,*p5; intx; for(p1=head;p1->next!=p4;) //對(duì)鏈表進(jìn)行從大到小排序(這里用冒泡法) //p1使之總是指向頭結(jié)點(diǎn),p4使之總是指向已排序好旳最前面旳結(jié)點(diǎn) //p3作為中介,保留p2旳上一種結(jié)點(diǎn) { f
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度訂制尺寸訂框安裝合同
- 2025年度物流企業(yè)合作投資與知識(shí)產(chǎn)權(quán)保護(hù)協(xié)議
- 二零二五年度旅游企業(yè)法人景區(qū)經(jīng)營權(quán)轉(zhuǎn)讓合同
- 2025年度股權(quán)激勵(lì)協(xié)議書-員工股權(quán)激勵(lì)與股權(quán)激勵(lì)計(jì)劃實(shí)施合同范本
- 二零二五年度紅薯種植技術(shù)培訓(xùn)與收購服務(wù)合同
- 關(guān)于業(yè)務(wù)合作的函件示例
- 家裝設(shè)計(jì)行業(yè)項(xiàng)目執(zhí)行標(biāo)準(zhǔn)
- 幼兒園教育服務(wù)合作框架協(xié)議
- 初中力學(xué)基礎(chǔ)實(shí)驗(yàn)課教案
- 公司辦公管理規(guī)章制度手冊(cè)
- 2025天津市安全員-B證考試題庫附答案
- 二年級(jí)下冊(cè)數(shù)學(xué)口算題-可打印
- 公司信息化安全規(guī)章制度及操作手冊(cè)
- 新風(fēng)施工合同
- 2025-2030年園藝修剪機(jī)器人行業(yè)深度調(diào)研及發(fā)展戰(zhàn)略咨詢報(bào)告
- 人教版四年級(jí)數(shù)學(xué)下冊(cè)第四單元測試卷(含答案)
- 2025年湖北省技能高考(建筑技術(shù)類)《建筑工程測量》模擬練習(xí)試題庫(含答案)
- 2023年中國綜合社會(huì)調(diào)查調(diào)查手冊(cè)
- 2024-2027年中國網(wǎng)絡(luò)安全評(píng)估行業(yè)發(fā)展監(jiān)測及投資戰(zhàn)略研究報(bào)告
- 失智老年人照護(hù)X證書制度試點(diǎn)工作養(yǎng)老護(hù)理職業(yè)和失智老人照護(hù)員工種的發(fā)展講解
- 2025年湖南食品藥品職業(yè)學(xué)院高職單招職業(yè)技能測試近5年??及鎱⒖碱}庫含答案解析
評(píng)論
0/150
提交評(píng)論