已閱讀5頁,還剩18頁未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
中北大學(xué)數(shù)據(jù)結(jié)構(gòu)課 程 設(shè) 計(jì) 說 明 書學(xué)生姓名:周西財(cái)學(xué) 號:0706054236學(xué) 院:電子與計(jì)算機(jī)科學(xué)技術(shù)學(xué)院專 業(yè):軟件工程題 目:圖書借閱管理系統(tǒng)成績指導(dǎo)教師周海英2009 年 6 月 24 日1 設(shè)計(jì)目的通過設(shè)計(jì)掌握數(shù)據(jù)結(jié)構(gòu)課程 中學(xué)到的基本理論和算法并綜合運(yùn)用于理論實(shí)際問題中,它是理論與實(shí)踐結(jié)合的重要過程.設(shè)計(jì)要求學(xué)會對實(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ù)繁索、效率低下給具有強(qiáng)烈時(shí)間觀念的管理人員帶來了諸多不便,學(xué)校圖書館缺少一套完善的圖書管理軟件,為了對圖書的管理方便,因此必須開發(fā)圖書管理系統(tǒng)。2. 設(shè)計(jì)內(nèi)容和要求內(nèi)容:1)圖書管理(增加圖書、查詢圖書、刪除圖書、圖書借閱、還書);2)會員管理(增加會員、查詢會員、刪除會員、借書信息);要求:根據(jù)設(shè)計(jì)內(nèi)容建立相關(guān)數(shù)據(jù)的動(dòng)態(tài)鏈表存儲結(jié)構(gòu)3本設(shè)計(jì)所采用的數(shù)據(jù)結(jié)構(gòu)采用兩條單鏈表,其頭結(jié)點(diǎn)分別為head、mhead的全局變量來存儲圖書信息和會員信息。其定義數(shù)據(jù)結(jié)構(gòu)如下:/*圖書信息結(jié)構(gòu)體*/typedef struct elemchar bookid5;char bookname50;char bookauthor20;char bookmark2;char memberid4;elemtype;/*圖書鏈表結(jié)點(diǎn)結(jié)構(gòu)體*/typedef struct nodeelemtype data;struct node *next;lnode,*linknode;/*會員信息結(jié)構(gòu)體*/typedef struct memberelemchar memberid4;char membername20;memberelemtype;/*會員鏈表結(jié)點(diǎn)結(jié)構(gòu)體*/typedef struct membernodememberelemtype data;struct membernode *next;mlnode,*mlinknode;4功能模塊詳細(xì)設(shè)計(jì)圖書借閱管理系統(tǒng)圖書管理模塊會員管理模塊增加圖書查詢圖書刪除圖書圖書借閱還書增加會員查詢會員借書信息刪除會員4.1 詳細(xì)設(shè)計(jì)思想系統(tǒng)啟動(dòng)時(shí),通過讀取文件完成對以head、mhead為表頭的單鏈表完成初始化。初始化后系統(tǒng)進(jìn)入系統(tǒng)菜單,其運(yùn)行界面如下: 當(dāng)選擇功能1時(shí),進(jìn)入圖書管理模塊,其運(yùn)行界面如下:當(dāng)選擇功能2時(shí),進(jìn)入會員管理模塊,其運(yùn)行界面如下: 為了實(shí)現(xiàn)上述功能,特定義以下函數(shù)原型,具體代碼參見源代碼部分:void main() /*入口*/void initallinfo() /*初始化圖書和會員鏈表*/void welform() /*系統(tǒng)總菜單*/void printbookinfo(linknode head) /*輸出圖書信息函數(shù)*/void addbook() /*增加圖書模塊*/void select() /*按編號查詢圖書*/void delete() /*按編號刪除圖書*/void borrow() /*借閱圖書*/void returnbook() /*還書*/void bookmanagetitle() /*圖書管理二級菜單*/void bookmanage() /*二級圖書管理功能選擇函數(shù)*/void printmemberinfo(mlinknode head) /*輸出會員信息函數(shù)*/void addmember() /*增加會員模塊*/void selectmember() /*按編號查詢會員*/void deletemember() /*按編號刪除會員*/void membermanagetitle() /*會員管理二級菜單*/void membermanage() /*二級會員管理功能選擇函數(shù)*/程序調(diào)試運(yùn)用數(shù)據(jù)如下:圖書初始數(shù)據(jù)表bookidbooknamebookauthorbookmarkmemberid0001sanguoyanyiluoguanzhongN00002hongloumengcaoxueqinN00003xiyoujiwuchengenY0010004shuihuzhuanshinaianN00005javascriptJoinN00006cprogromtanghaoqiangN00007liaozhaizhiyipusonglingY0070008jiabajinN00009richucaoyuY0030010nahanluxunN0會員信息表memberidmembername001zhouxicai002longqidong003lipengfei004gaopeng005chenwentang006yangminghao4.2 源代碼main.c文件:#include#includetype.c#includeinit.c#includebook.c#includemember.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); 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: printf(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,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(nPress 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(*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 success!n); printf(nPress anykey retrun.); getchar(); getchar();/*按編號查詢圖書*/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-data.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,p-data.bookid,p-data.bookname,p-data.bookauthor,p-data.bookmark,p-data.memberid); printf(nPress anykey retrun.); getchar();getchar(); /*按編號刪除圖書*/void delete() char id5; linknode p,q; clrscr(); p=head-next;q=head; printf(delete book by id.nn); printf(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); printf(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.bookid,id)=0) break; else p=p-next; if(p=NULL) printf(nThe book doesnt 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) 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);getchar(); 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); 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); printf(nPress anykey retrun.); getchar();getchar();/*圖書管理二級菜單*/void bookmanagetitle() clrscr(); printf( BOOK MANAGE MENU n); printf(*n); printf(* 1: Look all books *n); printf(*-*n); printf(* 2: Add book *n); printf(*-*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(* 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();break; 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文件:/*輸出會員信息函數(shù)*/void printmemberinfo(mlinknode head) mlinknode mp=head-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.); getchar();getchar();/*增加會員模塊*/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-data.memberid,p-data.membername); p-next=mhead-next; mhead-next=p; printf(nnAdd success!); printf(nPress anykey retrun.); getchar(); getchar();/*按編號查詢會員*/void selectmember() char id4; mlinknode p; clrscr(); printf(select member by id.nn); p=mhead-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); printf(%-7s%sn,p-data.memberid,p-data.membername); printf(nnPress anykey retrun.); getchar(); getchar();/*按編號刪除會員*/void deletemember() char id4; mlinknode p,q; clrscr(); printf(delete member.nn); p=mhead-next;q=mhead; printf(Please input member 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 anykey retrun.); getchar(); getchar();/*會員管理二級菜單*/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); printf(* 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; default: printf(nYou hava input the wrong order!n);printf(Press anykey return.);getchar();getcha
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 小班月度工作計(jì)劃范文
- 2024年版職工崗位聘用協(xié)議樣本版B版
- 五年級上冊教學(xué)計(jì)劃三篇
- 服裝店工作計(jì)劃錦集
- 小學(xué)教學(xué)計(jì)劃模板合集六篇
- 2023傳染病防控工作計(jì)劃
- 在酒店實(shí)習(xí)報(bào)告合集10篇
- 藍(lán)金色大氣工作匯報(bào)模板
- 五年級感恩節(jié)的作文400字5篇
- 第三季度營銷策劃工作總結(jié)與計(jì)劃
- 期末 (試題) -2024-2025學(xué)年外研版(三起)(2024)英語三年級上冊
- 規(guī)范集團(tuán)中層管理人員退休返聘的若干規(guī)定
- 無機(jī)及分析化學(xué)考試題(附答案)
- “小學(xué)數(shù)學(xué)分層教學(xué)研究與實(shí)踐”課題成果報(bào)告
- 航海儀器頁課件
- 劉禹錫《陋室銘》課件(17張)
- 2022-2023學(xué)年龍泉驛區(qū)三年級數(shù)學(xué)第一學(xué)期期末綜合測試試題含解析
- 膝關(guān)節(jié)病護(hù)理查房ppt
- 西交《電子商務(wù)技術(shù)》在線作業(yè)答卷
- 2022年工程項(xiàng)目經(jīng)理任命書
- 《中國古代文學(xué)史——李白》優(yōu)秀PPT課件
評論
0/150
提交評論