圖書借閱綜合管理系統(tǒng)_第1頁
圖書借閱綜合管理系統(tǒng)_第2頁
圖書借閱綜合管理系統(tǒng)_第3頁
圖書借閱綜合管理系統(tǒng)_第4頁
圖書借閱綜合管理系統(tǒng)_第5頁
已閱讀5頁,還剩20頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

設(shè)計(jì)目標(biāo)《數(shù)據(jù)結(jié)構(gòu)》課程關(guān)鍵介紹最常見數(shù)據(jù)結(jié)構(gòu),說明多種數(shù)據(jù)結(jié)構(gòu)內(nèi)在邏輯關(guān)系,討論其在計(jì)算機(jī)中存放表示,和在其上進(jìn)行多種運(yùn)算時(shí)實(shí)現(xiàn)算法,并對(duì)算法效率進(jìn)行簡單分析和討論。進(jìn)行數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)要達(dá)成以下目標(biāo):了解并掌握數(shù)據(jù)結(jié)構(gòu)和算法設(shè)計(jì)方法,含有初步獨(dú)立分析和設(shè)計(jì)能力;初步掌握軟件開發(fā)過程問題分析、系統(tǒng)設(shè)計(jì)、程序編碼、測試等基礎(chǔ)方法和技能;提升綜合利用所學(xué)理論知識(shí)和方法獨(dú)立分析和處理問題能力;訓(xùn)練用系統(tǒng)見解和軟件開發(fā)通常規(guī)范進(jìn)行軟件開發(fā),培養(yǎng)軟件工作者所應(yīng)含有科學(xué)工作方法和作風(fēng)。設(shè)計(jì)內(nèi)容和要求關(guān)鍵分為兩大功效:(1)圖書管理(增加圖書、查詢圖書、刪除圖書、圖書借閱、還書);(2)會(huì)員管理(增加會(huì)員、查詢會(huì)員、刪除會(huì)員、借書信息)。設(shè)計(jì)要求:(1)符合課題要求,實(shí)現(xiàn)對(duì)應(yīng)功效;(2)要求界面友好美觀,操作方便易行;(3)注意程序?qū)嵱眯?、安全性?.本設(shè)計(jì)所采取數(shù)據(jù)結(jié)構(gòu)采取兩條單鏈表,其頭結(jié)點(diǎn)分別為head、mhead全局變量來存放圖書信息和會(huì)員信息。其定義數(shù)據(jù)結(jié)構(gòu)以下:/*圖書信息結(jié)構(gòu)體*/typedefstructelem{ charbookid[5]; charbookname[50]; charbookauthor[20]; charbookmark[2]; charmemberid[4]; }elemtype;/*圖書鏈表結(jié)點(diǎn)結(jié)構(gòu)體*/typedefstructnode{ elemtypedata; structnode*next; }lnode,*linknode;/*會(huì)員信息結(jié)構(gòu)體*/typedefstructmemberelem{ charmemberid[4]; charmembername[20]; }memberelemtype;/*會(huì)員鏈表結(jié)點(diǎn)結(jié)構(gòu)體*/typedefstructmembernode{ memberelemtypedata; structmembernode*next; }mlnode,*mlinknode;4.功效模塊具體設(shè)計(jì)圖書借閱管理系統(tǒng)圖書借閱管理系統(tǒng)圖書管理模塊會(huì)員管理模塊增加圖書查詢圖書刪除圖書圖書借閱還書增加會(huì)員查詢會(huì)員借書信息刪除會(huì)員4.1具體設(shè)計(jì)思想系統(tǒng)開啟時(shí),經(jīng)過讀取文件完成對(duì)以head、mhead為表頭單鏈表完成初始化。初始化后系統(tǒng)進(jìn)入系統(tǒng)菜單,其運(yùn)行界面以下:當(dāng)選擇功效1時(shí),進(jìn)入圖書管理模塊,其運(yùn)行界面以下:當(dāng)選擇功效2時(shí),進(jìn)入會(huì)員管理模塊,其運(yùn)行界面以下:在圖書管理界面中,當(dāng)選擇功效1時(shí),查看全部圖書,其運(yùn)行界面圖:在會(huì)員管理界面中,當(dāng)選擇功效1時(shí),查看全部會(huì)員,其運(yùn)行界面圖:4.2各個(gè)實(shí)現(xiàn)函數(shù)為了實(shí)現(xiàn)上述功效,特定義以下函數(shù)原型,具體代碼參見源代碼部分:voidmain()/*入口*/voidinitallinfo()/*初始化圖書和會(huì)員鏈表*/voidwelform()/*系統(tǒng)總菜單*/voidprintbookinfo(linknodehead)/*輸出圖書信息函數(shù)*/voidaddbook()/*增加圖書模塊*/voidselect()/*按編號(hào)查詢圖書*/voiddelete()/*按編號(hào)刪除圖書*/voidborrow()/*借閱圖書*/voidreturnbook()/*還書*/voidbookmanagetitle()/*圖書管理二級(jí)菜單*/voidbookmanage()/*二級(jí)圖書管理功效選擇函數(shù)*/voidprintmemberinfo(mlinknodehead)/*輸出會(huì)員信息函數(shù)*/voidaddmember()/*增加會(huì)員模塊*/voidselectmember()/*按編號(hào)查詢會(huì)員*/voiddeletemember()/*按編號(hào)刪除會(huì)員*/voidmembermanagetitle()/*會(huì)員管理二級(jí)菜單*/voidmembermanage()/*二級(jí)會(huì)員管理功效選擇函數(shù)*/4.4圖書會(huì)員鏈表程序調(diào)試數(shù)據(jù)如表:圖書初始數(shù)據(jù)表bookidbooknamebookauthorbookmarkmemberid0001sanguoyanyiluoguanzhongN00002hongloumengcaoxueqinN00003xiyoujiwuchengenY0010004shuihuzhuanshinaianN00005javascriptJoinN00006cprogromtanghaoqiangN00007liaozhaizhiyipusonglingY0070008jiabajinN00009richucaoyuY0030010nahanluxunN0會(huì)員信息表memberidmembername001zhouxicai002longqidong003lipengfei004gaopeng005chenwentang006yangminghao4.5關(guān)鍵代碼#include<stdio.h>#include<conio.h>#include<stdlib.h>#include<string.h>#defineNULL0typedefstructelem{ charbookid[5]; charbookname[50]; charbookauthor[20]; charbookmark[2]; charmemberid[5];}elemtype;typedefstructnode{ elemtypedata; structnode*next;}lnode,*linknode;typedefstructmemberelem{ charmemberid[5]; charmembername[25];}memberelemtype;typedefstructmembernode{ memberelemtypedata; structmembernode*next;}mlnode,*mlinknode;linknodehead;mlinknodemhead;FILE*bp,*bq;voidinitallinfo(){ FILE*bp,*bq; linknodep,q; mlinknodem,n; head=(lnode*)malloc(sizeof(lnode)); head->next=NULL; mhead=(mlnode*)malloc(sizeof(mlnode)); mhead->next=NULL; bp=fopen("book.txt","rb"); printf("%s",feof(bp)); bq=fopen("member.txt","rb"); printf("%s",feof(bp)); if(bp==NULL) { printf("cannotopenbookbat!"); getchar(); getchar(); } else { do { p=(lnode*)malloc(sizeof(lnode)); fread(p,sizeof(lnode),1,bp); q=p->next; p->next=head->next; head->next=p; }while(q!=NULL); fclose(bp); } if(bq==NULL) { printf("cannotopenmemberdat!"); getchar(); getchar(); } else { do { m=(mlnode*)malloc(sizeof(mlnode)); fread(m,sizeof(mlnode),1,bq); n=m->next; m->next=mhead->next; mhead->next=m; }while(n!=NULL);fclose(bq); }}voidmainmenu(){ system("cls"); printf("SYSTEMMAINMENU\n"); printf("*********************************************\n"); printf("*1:bookmanage*\n"); printf("*-------------------------------------------*\n"); printf("*2:membermanage*\n"); printf("*-------------------------------------------*\n"); printf("*0:quit*\n"); printf("*********************************************\n"); printf("\nPleaseinputorder:\n");}voidprintbookinfo(linknodehead){ linknodep=head->next; system("cls"); printf("Thebookinformationsare:\n"); printf("%-7s%-20s%-15s%-6s%s\n","id","title","author","mark","borrower"); printf("*********************************************\n"); for(;p!=NULL;p=p->next) printf("%-7s%-20s%-15s%-6s%s\n",p->data.bookid,p->data.bookname,p->data.bookauthor,p->data.bookmark,p->data.memberid); printf("\nPleaseanykeyreturn....."); getchar(); getchar();}voidaddbook(){ linknodep=(lnode*)malloc(sizeof(lnode)); system("cls"); printf("Addbooks.....\n"); printf("%-7s%-20s%-15s%\n","id(5)","title","author"); printf("*********************************************\n"); scanf("%s%s%s",p->data.bookid,p->data.bookname,p->data.bookauthor); p->data.bookmark[0]='N'; p->data.bookmark[1]='\0'; p->data.memberid[0]='0'; p->data.memberid[1]='\0'; p->next=head->next; head->next=p; printf("\nAddsuccess!\n"); printf("\nPressanykeyreturn....."); getchar(); getchar();}voidselect(){ charid[5]; linknodep; system("cls"); p=head->next; printf("selectbookbyid.....\n"); printf("Pleaseinputbookid:\n"); scanf("%s",id); while(p!=NULL) { if(strcmp(p->data.bookid,id)==0) break; else p=p->next; } if(p==NULL) printf("\nThebooknotexit!\n"); else { printf("\n%-7s%-20s%-15s%-3s%s\n","id","title","author","borrowed","borrower"); printf("********************************************\n"); printf("\n%-7s%-20s%-15s%-3s%s\n",p->data.bookid,p->data.bookname,p->data.bookauthor,p->data.bookmark,p->data.memberid); } printf("\nPleaseanykeyreturn....."); getchar(); getchar();}voiddeletebook(){ charid[5]; linknodep,q; system("cls"); p=head->next; q=head; printf("deletebookbyid......\n"); printf("Pleaseinputbookid:\n"); scanf("%s",id); while(p!=NULL) { if(strcmp(p->data.bookid,id)==0) break; else { q=p; p=p->next; } } if(p==NULL) printf("\nThebookyouwanttodeletearenotexit!\n"); else { q->next=p->next; free(p); printf("\nDeletesuccess!\n"); } printf("\nPressanykeyreturn....."); getchar(); getchar();}voidborrow(){ charid[5]; charmid[5]; linknodep; mlinknodeq; system("cls"); printf("borrowbook.....\n"); do { p=head->next; printf("Pleaseinputbookid:\n"); scanf("%s",id); while(p!=NULL) { if(strcmp(p->data.bookid,id)==0) break; else p=p->next; } if(p==NULL) { printf("\nThebookdoesn'texit!pleaseinputitagain!\n"); } }while(p!=NULL); if(p!=NULL) { do { q=mhead->next; printf("\nPleaseinputmemberid:\n"); scanf("%s",mid); while(q!=NULL) { if(strcmp(q->data.memberid,mid)==0) break; else q=q->next; } if(q==NULL) { printf("\nYouarenotmember!inputagain!\n"); } }while(q==NULL); if(q!=NULL&&(strcmp(p->data.bookmark,"Y"))!=0) { strcpy(p->data.bookmark,"Y"); strcpy(p->data.memberid,q->data.memberid); printf("\nsuccessed!\n"); getchar(); getchar(); } else { printf("\nThebookhaveborrowed,pleasewaitafewdays....."); getchar(); getchar(); } } printf("\nPressanykeyreturn....."); getchar(); getchar();}voidreturnbook(){ charid[5]; linknodep; system("cls"); p=head->next; printf("returnbook.....\n"); printf("Pleaseinputbookid:\n"); scanf("%s",id); while(p!=NULL) { if(strcmp(p->data.bookid,id)==0) break; else p=p->next; } if(p==NULL) printf("\nThebookyouwanttoretrunarenotexit!\n"); else { strcpy(p->data.bookmark,"N"); strcpy(p->data.memberid,"0"); printf("\nsuccessed!\n"); } printf("\nPressanykeyreturn....."); getchar(); getchar();}voidbookmanagetitle(){ system("cls"); printf("BOOKMANAGEMENU\n"); printf("*********************************************\n"); printf("*1:Lookallbooks*\n"); printf("*-------------------------------------------*\n"); printf("*2:Addbook*\n"); printf("*-------------------------------------------*\n"); printf("*3:Selectbookbyid*\n"); printf("*-------------------------------------------*\n"); printf("*4:Deletebookbyid*\n"); printf("*-------------------------------------------*\n"); printf("*5:Borrowbook*\n"); printf("*-------------------------------------------*\n"); printf("*6:Returnbook*\n"); printf("*-------------------------------------------*\n"); printf("*0:Returntomainform*\n"); printf("*********************************************\n"); printf("\nPleaseinputorder:\n");}voidbookmanage(){ intch; while(1) { bookmanagetitle(); scanf("%d",&ch); if(ch==0) break; switch(ch) { case1:printbookinfo(head); break; case2:addbook(); break; case3:select(); break; case4:deletebook(); break; case5:borrow(); break; case6:returnbook(); break; case0:break;default:printf("\nTouhaveinputthewrongorder!\n");printf("Pressanykeyreturn....."); getchar(); getchar(); } }}voidprintmemberinfo(mlinknodehead){ mlinknodemp=head->next; system("cls"); printf("Thememberinfomationsare....\n"); printf("%-7s%s\n","id","name"); printf("********************************************\n"); for(;mp!=NULL;mp=mp->next) printf("%-7s%s\n",mp->data.memberid,mp->data.membername); printf("\nPressanykeykeyreturn....."); getchar(); getchar();}voidaddmember(){ mlinknodep=(mlnode*)malloc(sizeof(mlnode)); system("cls"); printf("Addmember.....\n"); printf("%-7s%s\n","id","name"); printf("*******************************************\n"); scanf("%s%s",p->data.memberid,p->data.membername); p->next=mhead->next; mhead->next=p; printf("\nAddsuccess!"); printf("\nPressanykeyreturn....."); getchar(); getchar();}voidselectmember(){ charid[5]; mlinknodep; system("cls"); printf("selectmemberbyid.....\n"); p=mhead->next; printf("Pleaseinputmemberid:\n"); scanf("%s",id); while(p!=NULL) { if(strcmp(p->data.memberid,id)==0) break; else p=p->next; } if(p==NULL) printf("\nThemembernotexit!\n"); else { printf("\n%-7s%s\n","id","name"); printf("*****************************************\n"); printf("%-7s%s\n",p->data.memberid,p->data.membername); } printf("\nPressanykeyreturn....."); getchar(); getchar();}voiddeletemember(){ charid[5]; mlinknodep,q; system("cls"); printf("deletemember.....\n"); p=mhead->next; q=mhead; printf("Pleaseinputmemberid:\n"); scanf("%s",id); while(p!=NULL) { if(strcmp(p->data.memberid,id)==0) break; else { q=p; p=p->next; } } if(p==NULL) printf("\nThememberyouwanttodeletearenotexit!\n"); else { q->next=p->next; free(p); printf("\nDeletesuccess!\n"); } printf("\nPressanykeyreturn....."); getchar(); getchar();}voidmembermanagetitle(){ system("cls"); printf("MEMBERMANAGEMENU\n"); printf("*******************************************\n"); printf("*1:Lookallmemberinfo*\n"); printf("*-----------------------------------------*\n"); printf("*2:Addmember*\n"); printf("*-----------------------------------------*\n"); printf("*3:Selectmemberbyid*\n"); printf("*--------------------------------

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論