图书借阅管理系统数据结构课程设计说明书.doc

上传人:豆**** 文档编号:33546056 上传时间:2022-08-11 格式:DOC 页数:17 大小:107KB
返回 下载 相关 举报
图书借阅管理系统数据结构课程设计说明书.doc_第1页
第1页 / 共17页
图书借阅管理系统数据结构课程设计说明书.doc_第2页
第2页 / 共17页
点击查看更多>>
资源描述

《图书借阅管理系统数据结构课程设计说明书.doc》由会员分享,可在线阅读,更多相关《图书借阅管理系统数据结构课程设计说明书.doc(17页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、如有侵权,请联系网站删除,仅供学习与交流图书借阅管理系统数据结构课程设计说明书【精品文档】第 17 页中北大学数据结构课 程 设 计 说 明 书学生姓名:周西财学 号:0706054236学 院:电子与计算机科学技术学院专 业:软件工程题 目:图书借阅管理系统成绩指导教师周海英2009 年 6 月 24 日1 设计目的通过设计掌握数据结构课程 中学到的基本理论和算法并综合运用于理论实际问题中,它是理论与实践结合的重要过程.设计要求学会对实际问题定义相关数据结构,并采用恰当的设计方法和算法解决问题,同时训练学生进行复杂程序设计的技能和培养良好的程序设计习惯.人工管理图书的手续繁索、效率低下给具有

2、强烈时间观念的管理人员带来了诸多不便,学校图书馆缺少一套完善的图书管理软件,为了对图书的管理方便,因此必须开发图书管理系统。2. 设计内容和要求内容:1)图书管理(增加图书、查询图书、删除图书、图书借阅、还书);2)会员管理(增加会员、查询会员、删除会员、借书信息);要求:根据设计内容建立相关数据的动态链表存储结构3本设计所采用的数据结构采用两条单链表,其头结点分别为head、mhead的全局变量来存储图书信息和会员信息。其定义数据结构如下:/*图书信息结构体*/typedef struct elemchar bookid5;char bookname50;char bookauthor20;

3、char bookmark2;char memberid4;elemtype;/*图书链表结点结构体*/typedef struct nodeelemtype data;struct node *next;lnode,*linknode;/*会员信息结构体*/typedef struct memberelemchar memberid4;char membername20;memberelemtype;/*会员链表结点结构体*/typedef struct membernodememberelemtype data;struct membernode *next;mlnode,*mlinkno

4、de;4功能模块详细设计图书借阅管理系统图书管理模块会员管理模块增加图书查询图书删除图书图书借阅还书增加会员查询会员借书信息删除会员4.1 详细设计思想系统启动时,通过读取文件完成对以head、mhead为表头的单链表完成初始化。初始化后系统进入系统菜单,其运行界面如下:当选择功能1时,进入图书管理模块,其运行界面如下:当选择功能2时,进入会员管理模块,其运行界面如下:为了实现上述功能,特定义以下函数原型,具体代码参见源代码部分:void main() /*入口*/void initallinfo() /*初始化图书和会员链表*/void welform() /*系统总菜单*/void pri

5、ntbookinfo(linknode head) /*输出图书信息函数*/void addbook() /*增加图书模块*/void select() /*按编号查询图书*/void delete() /*按编号删除图书*/void borrow() /*借阅图书*/void returnbook() /*还书*/void bookmanagetitle() /*图书管理二级菜单*/void bookmanage() /*二级图书管理功能选择函数*/void printmemberinfo(mlinknode head) /*输出会员信息函数*/void addmember() /*增加会员

6、模块*/void selectmember() /*按编号查询会员*/void deletemember() /*按编号删除会员*/void membermanagetitle() /*会员管理二级菜单*/void membermanage() /*二级会员管理功能选择函数*/程序调试运用数据如下:图书初始数据表bookidbooknamebookauthorbookmarkmemberid0001sanguoyanyiluoguanzhongN00002hongloumengcaoxueqinN00003xiyoujiwuchengenY0010004shuihuzhuanshinaianN

7、00005javascriptJoinN00006cprogromtanghaoqiangN00007liaozhaizhiyipusonglingY0070008jiabajinN00009richucaoyuY0030010nahanluxunN0会员信息表memberidmembername001zhouxicai002longqidong003lipengfei004gaopeng005chenwentang006yangminghao4.2 源代码main.c文件:#include#includetype.c#includeinit.c#includebook.c#includeme

8、mber.c/*系统总菜单*/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(); s

9、canf(%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文件:/*输出图书信息函数*/void printbookinfo(linknode head) linknode p=head-next; clrscr(); printf(The bo

10、ok 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 addb

11、ook() 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.m

12、emberid1=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.bo

13、okid,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.); g

14、etchar();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

15、 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(

16、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

17、(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.);

18、 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

19、.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: Sele

20、ct 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();

21、 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.);ge

22、tchar();getchar();MEMBER.C文件:/*输出会员信息函数*/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.); ge

23、tchar();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!); p

24、rintf(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(nTh

25、e 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 in

26、put 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 mem

27、bermanagetitle() 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)

28、; 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(n

29、You hava input the wrong order!n);printf(Press anykey return.);getchar();getchar();INIT.C文件:/*初始化图书和会员链表*/void initallinfo() FILE *fp; linknode p,q;mlinknode m,n; head=(lnode *)malloc(sizeof(lnode); head-next=NULL; mhead=(mlnode *)malloc(sizeof(mlnode); mhead-next=NULL; fp=fopen(information.txt,rb);

30、printf(%s,feof(fp); if(fp=NULL)printf(can not open bookdat!); getchar(); else do p=(lnode *)malloc(sizeof(lnode); fread(p,sizeof(lnode),1,fp); q=p-next;p-next=head-next; head-next=p; while(q!=NULL);do m=(mlnode *)malloc(sizeof(mlnode); fread(m,sizeof(mlnode),1,fp); n=m-next; m-next=mhead-next; mhead

31、-next=m; while(n!=NULL); fclose(fp);type.c文件:#includetypedef struct elemchar bookid5;char bookname50;char bookauthor20;char bookmark2;char memberid4;elemtype;typedef struct nodeelemtype data;struct node *next;lnode,*linknode;typedef struct memberelemchar memberid4;char membername20;memberelemtype;typedef struct membernodememberelemtype data;struct membernode *next;mlnode,*mlinknode;linknode head;mlinknode mhead;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 家庭教育

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁