版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、中北大學(xué)數(shù)據(jù)結(jié)構(gòu)課 程 設(shè) 計(jì) 說 明 書 學(xué)生姓名:周西財(cái) 學(xué) 號(hào):0706054236 學(xué) 院:電子與計(jì)算機(jī)科學(xué)技術(shù)學(xué)院專 業(yè):軟件工程 題 目:圖書借閱管理系統(tǒng)成績(jī) 指導(dǎo)教師周海英 2009 年 6 月 24 日1 設(shè)計(jì)目的通過設(shè)計(jì)掌握數(shù)據(jù)結(jié)構(gòu)課程 中學(xué)到的基本理論和算法并綜合運(yùn)用于理論實(shí)際問題中,它是理論與實(shí)踐結(jié)合的重要過程.設(shè)計(jì)要求學(xué)會(huì)對(duì)實(shí)際問題定義相關(guān)數(shù)據(jù)結(jié)構(gòu),并采用恰當(dāng)?shù)脑O(shè)計(jì)方法和算法解決問題,同時(shí)訓(xùn)練學(xué)生進(jìn)行復(fù)雜程序設(shè)計(jì)的技能和培養(yǎng)良好的程序設(shè)計(jì)習(xí)慣.人工管理圖書的手續(xù)繁索、效率低下
2、給具有強(qiáng)烈時(shí)間觀念的管理人員帶來了諸多不便,學(xué)校圖書館缺少一套完善的圖書管理軟件,為了對(duì)圖書的管理方便,因此必須開發(fā)圖書管理系統(tǒng)。2. 設(shè)計(jì)內(nèi)容和要求內(nèi)容:1)圖書管理(增加圖書、查詢圖書、刪除圖書、圖書借閱、還書);2)會(huì)員管理(增加會(huì)員、查詢會(huì)員、刪除會(huì)員、借書信息);要求:根據(jù)設(shè)計(jì)內(nèi)容建立相關(guān)數(shù)據(jù)的動(dòng)態(tài)鏈表存儲(chǔ)結(jié)構(gòu)3本設(shè)計(jì)所采用的數(shù)據(jù)結(jié)構(gòu)采用兩條單鏈表,其頭結(jié)點(diǎn)分別為head、mhead的全局變量來存儲(chǔ)圖書信息和會(huì)員信息。其定義數(shù)據(jù)結(jié)構(gòu)如下:/*圖書信息結(jié)構(gòu)體*/typedef struct elemchar bookid5;char bookname50;char bookauthor
3、20;char bookmark2;char memberid4;elemtype;/*圖書鏈表結(jié)點(diǎn)結(jié)構(gòu)體*/typedef struct nodeelemtype data;struct node *next;lnode,*linknode;/*會(huì)員信息結(jié)構(gòu)體*/typedef struct memberelemchar memberid4;char membername20;memberelemtype;/*會(huì)員鏈表結(jié)點(diǎn)結(jié)構(gòu)體*/typedef struct membernodememberelemtype data;struct membernode *next;mlnode,*mlin
4、knode;4功能模塊詳細(xì)設(shè)計(jì)圖書借閱管理系統(tǒng)圖書管理模塊會(huì)員管理模塊增加圖書查詢圖書刪除圖書圖書借閱還書增加會(huì)員查詢會(huì)員借書信息刪除會(huì)員4.1 詳細(xì)設(shè)計(jì)思想系統(tǒng)啟動(dòng)時(shí),通過讀取文件完成對(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)行界面如下: 為了實(shí)現(xiàn)上述功能,特定義以下函數(shù)原型,具體代碼參見源代碼部分:void main() /*入口*/void initallinfo() /*初始化圖書和會(huì)員鏈表*/void welform() /*系統(tǒng)總菜單*/voi
5、d printbookinfo(linknode head) /*輸出圖書信息函數(shù)*/void addbook() /*增加圖書模塊*/void select() /*按編號(hào)查詢圖書*/void delete() /*按編號(hào)刪除圖書*/void borrow() /*借閱圖書*/void returnbook() /*還書*/void bookmanagetitle() /*圖書管理二級(jí)菜單*/void bookmanage() /*二級(jí)圖書管理功能選擇函數(shù)*/void printmemberinfo(mlinknode head) /*輸出會(huì)員信息函數(shù)*/void addmember() /
6、*增加會(huì)員模塊*/void selectmember() /*按編號(hào)查詢會(huì)員*/void deletemember() /*按編號(hào)刪除會(huì)員*/void membermanagetitle() /*會(huì)員管理二級(jí)菜單*/void membermanage() /*二級(jí)會(huì)員管理功能選擇函數(shù)*/程序調(diào)試運(yùn)用數(shù)據(jù)如下:圖書初始數(shù)據(jù)表bookidbooknamebookauthorbookmarkmemberid0001sanguoyanyiluoguanzhongN00002hongloumengcaoxueqinN00003xiyoujiwuchengenY0010004shuihuzhuanshin
7、aianN00005javascriptJoinN00006cprogromtanghaoqiangN00007liaozhaizhiyipusonglingY0070008jiabajinN00009richucaoyuY0030010nahanluxunN0會(huì)員信息表memberidmembername001zhouxicai002longqidong003lipengfei004gaopeng005chenwentang006yangminghao4.2 源代碼main.c文件:#include<conio.h>#include"type.c"#inclu
8、de"init.c"#include"book.c"#include"member.c"/*系統(tǒng)總菜單*/void welform() clrscr(); printf(" SYSTEM MAIN MENU n"); printf("*n"); printf("* 1: book manage *n"); printf("*-*n"); printf("* 2: member manage *n"); printf("*-*n
9、"); printf("* 0: quit *n"); printf("*n"); printf("nnPlease input order:n");void main() int ch; initallinfo(); /*初始化鏈表*/ while(1) welform(); scanf("%d",&ch); switch(ch) case 1:bookmanage();break; case 2:membermanage();break; case 0:exit(0); default: pr
10、intf("nYou hava input the wrong order!n"); printf("Press anykey return."); getchar(); getchar(); BOOK.C文件:/*輸出圖書信息函數(shù)*/void printbookinfo(linknode head) linknode p=head->next; clrscr(); printf("The book informations are:nn"); printf("%-7s%-20s%-15s%-6s%sn",&
11、quot;id","title","author","mark","borower");printf("*nn"); for(;p!=NULL;p=p->next)printf("%-7s%-20s%-15s%-6s%sn",p->data.bookid,p->data.bookname,p->data.bookauthor,p->data.bookmark,p->data.memberid); printf("nPre
12、ss anykey retrun."); getchar();getchar();/*增加圖書模塊*/void addbook() linknode p=(lnode *)malloc(sizeof(lnode); clrscr(); printf("Add books.n"); printf("please input bookinfo:nn"); printf("%-7s%-20s%-15sn","id(4)","title","author"); printf
13、("*n"); scanf("%s%s%s",p->data.bookid,p->data.bookname,p->data.bookauthor); p->data.bookmark0='N' p->data.bookmark1='0' p->data.memberid0='0' p->data.memberid1='0' p->next=head->next; head->next=p; printf("nnAdd s
14、uccess!n"); printf("nPress anykey retrun."); getchar(); getchar();/*按編號(hào)查詢圖書*/void select() char id5; linknode p; clrscr(); p=head->next; printf("select book by id.nn"); printf("Please input book id:n"); scanf("%s",id); while(p!=NULL) if(strcmp(p->da
15、ta.bookid,id)=0) break; else p=p->next; if(p=NULL) printf("nThe book not exit!n"); else printf("n%-7s%-20s%-15s%-3s%sn","id","title","author","borowed","borower"); printf("*n"); printf("n%-7s%-20s%-15s%-3s%sn&quo
16、t;,p->data.bookid,p->data.bookname,p->data.bookauthor,p->data.bookmark,p->data.memberid); printf("nPress anykey retrun."); getchar();getchar(); /*按編號(hào)刪除圖書*/void delete() char id5; linknode p,q; clrscr(); p=head->next;q=head; printf("delete book by id.nn"); printf
17、("Please input book id: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("nThe book you want to delete are not exit!n"); else q->next=p->next; free(p); printf("nDelete success!n"); prin
18、tf("nPress anykey retrun."); getchar(); getchar();/*借閱圖書*/void borrow() char id5; char mid4; linknode p; mlinknode q; clrscr(); printf("borrow book.nn"); do p=head->next; printf("Please input book id:n"); scanf("%s",id); while(p!=NULL) if(strcmp(p->data.
19、bookid,id)=0) break; else p=p->next; if(p=NULL) printf("nThe book doesn't exit! please input it again!nn"); while(p=NULL); if(p!=NULL) do q=mhead->next; printf("nPlease input member id:n"); scanf("%s",mid); while(q!=NULL) if(strcmp(q->data.memberid,mid)=0)
20、break; else q=q->next; if(q=NULL) printf("nYou are not member! input againn"); 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");g
21、etchar(); else printf("nnThe book have borrowed, please wait a few days."); getchar(); printf("nnPress anykey retrun."); getchar();/*還書*/void returnbook() char id5; linknode p; clrscr(); p=head->next; printf("return book.nn"); printf("Please input book id:n"
22、;); scanf("%s",id); while(p!=NULL) if(strcmp(p->data.bookid,id)=0) break; else p=p->next; if(p=NULL) printf("nThe book you want to return are not exit!n"); else strcpy(p->data.bookmark,"N");strcpy(p->data.memberid,"0"); printf("nsuccessed!n&qu
23、ot;); printf("nPress anykey retrun."); getchar();getchar();/*圖書管理二級(jí)菜單*/void bookmanagetitle() clrscr(); printf(" BOOK MANAGE MENU n"); printf("*n"); printf("* 1: Look all books *n"); printf("*-*n"); printf("* 2: Add book *n"); printf("
24、*-*n"); printf("* 3: Select book by id *n"); printf("*-*n"); printf("* 4: Delete book by id *n"); printf("*-*n"); printf("* 5: Borrow book *n"); printf("*-*n"); printf("* 6: Return book *n"); printf("*-*n"); printf(
25、"* 0: Return to main form *n"); printf("*n"); printf("nPlease input order:n");void bookmanage() int ch; while(1) bookmanagetitle(); scanf("%d",&ch); if(ch=0) break; switch(ch) case 1: printbookinfo(head);break; case 2: addbook();break; case 3: select();bre
26、ak; case 4: delete();break; case 5: borrow();break; case 6: returnbook();break; case 0:break; default: printf("nnYou hava input the wrong order!n");printf("Press anykey return.");getchar();getchar(); MEMBER.C文件:/*輸出會(huì)員信息函數(shù)*/void printmemberinfo(mlinknode head) mlinknode mp=head-&g
27、t;next; clrscr(); printf("The member infomations are.nn"); printf("%-7s%sn","id","name"); printf("*nn"); for(;mp!=NULL;mp=mp->next)printf("%-7s%sn",mp->data.memberid,mp->data.membername); printf("nPress anykey retrun.");
28、getchar();getchar();/*增加會(huì)員模塊*/void addmember() mlinknode p=(mlnode *)malloc(sizeof(mlnode); clrscr(); printf("Add member.n"); printf("please input memberinfo:nn"); printf("%-7s%sn","id","name"); printf("*n"); scanf("%s%s",p->da
29、ta.memberid,p->data.membername); p->next=mhead->next; mhead->next=p; printf("nnAdd success!"); printf("nPress anykey retrun."); getchar(); getchar();/*按編號(hào)查詢會(huì)員*/void selectmember() char id4; mlinknode p; clrscr(); printf("select member by id.nn"); p=mhead->
30、;next; printf("Please input member id:n"); scanf("%s",id); while(p!=NULL) if(strcmp(p->data.memberid,id)=0) break; else p=p->next; if(p=NULL) printf("nThe member not exit!n"); else printf("n%-7s%sn","id","name"); printf("*nn"
31、;); printf("%-7s%sn",p->data.memberid,p->data.membername); printf("nnPress anykey retrun."); getchar(); getchar();/*按編號(hào)刪除會(huì)員*/void deletemember() char id4; mlinknode p,q; clrscr(); printf("delete member.nn"); p=mhead->next;q=mhead; printf("Please input memb
32、er id: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("nThe member you want to delete are not exit!n"); else q->next=p->next; free(p); printf("nDelete success!n"); printf("nPress an
33、ykey retrun."); getchar(); getchar();/*會(huì)員管理二級(jí)菜單*/void membermanagetitle() clrscr(); printf(" MEMBER MANAGE MENU n"); printf("*n"); printf("* 1: Look all memberinfo *n"); printf("*-*n"); printf("* 2: Add member *n"); printf("*-*n"); pri
34、ntf("* 3: Select member by id *n"); printf("*-*n"); printf("* 4: Delete member by id *n"); printf("*-*n"); printf("* 0: Return to main form *n"); printf("*n"); printf("nPlease input order:n");void membermanage() int ch; while(1) membermanagetitle(); scanf("%d",&ch); if(ch=0) break; switch(ch) case 1: printmemberinfo(mhead);break; case 2: addmember();break; case 3: selectmember();break; case 4: deletemember();break; case 0:break; def
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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年個(gè)人房產(chǎn)抵押權(quán)抵押權(quán)轉(zhuǎn)讓合同3篇
- 2025年度個(gè)人貸款擔(dān)保轉(zhuǎn)讓合同4篇
- 2025版住宅室內(nèi)精裝修與裝飾工程施工合同5篇
- 人類的起源和發(fā)展課件2
- 出租車行業(yè)環(huán)保措施考核試卷
- 團(tuán)隊(duì)建設(shè)力量培養(yǎng)項(xiàng)目計(jì)劃書考核試卷
- 印刷業(yè)科技創(chuàng)新與成果轉(zhuǎn)化考核試卷
- 二零二五年度藝術(shù)品交易居間代理合同樣本3篇
- 2025年創(chuàng)業(yè)創(chuàng)新貸款協(xié)議
- 2025年合作知名作者的高需求小說電子書協(xié)議
- 廣東省佛山市2025屆高三高中教學(xué)質(zhì)量檢測(cè) (一)化學(xué)試題(含答案)
- 人教版【初中數(shù)學(xué)】知識(shí)點(diǎn)總結(jié)-全面+九年級(jí)上冊(cè)數(shù)學(xué)全冊(cè)教案
- 2024年全國(guó)體育單招英語(yǔ)考卷和答案
- 食品安全管理制度可打印【7】
- 2024年九年級(jí)語(yǔ)文中考名著閱讀《儒林外史》考前練附答案
- 抖音麗人行業(yè)短視頻直播項(xiàng)目運(yùn)營(yíng)策劃方案
- 2024年江蘇揚(yáng)州市邗城文化旅游發(fā)展有限公司招聘筆試參考題庫(kù)含答案解析
- 小學(xué)六年級(jí)數(shù)學(xué)100道題解分?jǐn)?shù)方程
- 社區(qū)獲得性肺炎護(hù)理查房?jī)?nèi)科
- 淺談提高中學(xué)生歷史學(xué)習(xí)興趣的策略
- 項(xiàng)目管理實(shí)施規(guī)劃-無錫萬象城
評(píng)論
0/150
提交評(píng)論