C语言图书管理系统课程设计报告[1](1).docx

上传人:小飞机 文档编号:3155112 上传时间:2023-03-11 格式:DOCX 页数:17 大小:40.66KB
返回 下载 相关 举报
C语言图书管理系统课程设计报告[1](1).docx_第1页
第1页 / 共17页
C语言图书管理系统课程设计报告[1](1).docx_第2页
第2页 / 共17页
C语言图书管理系统课程设计报告[1](1).docx_第3页
第3页 / 共17页
C语言图书管理系统课程设计报告[1](1).docx_第4页
第4页 / 共17页
C语言图书管理系统课程设计报告[1](1).docx_第5页
第5页 / 共17页
亲,该文档总共17页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《C语言图书管理系统课程设计报告[1](1).docx》由会员分享,可在线阅读,更多相关《C语言图书管理系统课程设计报告[1](1).docx(17页珍藏版)》请在三一办公上搜索。

1、C语言图书管理系统课程设计报告1第三章 图书管理系统的设计与实现 3.1系统的需求分析 图书登记管理系统作为一个应用软件将为学校的老师和学生提供一个对学校图书馆深入了解并借阅、还书的平台。根据系统界面的提示信息对图书馆信息进行查询、初始化等操作 系统功能需求分析描述如下: 系统主菜单:进入系统和退出系统 功能菜单:显示可以进行的操作 查询主菜单:根据图书编号、书名、作者进行查询,并可显示所有图书信息 借还书主菜单:可以进行借书和还书等操作 3.2系统的设计 3.2.1 系统的总统设计 下面从系统的整体流程的功能模块、系统界面及数据结构进行总体设计。 (1)总体思想 本系统主要设计思想是实现图书

2、馆的功能机管理系统信息的查询、借书、还书等主要功能。系统的设计方法是结构化实际方法,系统用C语言进行开发用户可以清晰的了解图书馆内的情况。 系统模块结构图 根据需求分析结果,图书管理系统可以分为三大模块:查询 0 图书模块、借书功能模块、还书功能模块。 系统模块结构如图: 图 书 管理主菜单 图书管理系统 图书查询系统 借书功能系统 还书功能系统 3.2.2 系统的概要设计 系统主菜单。 显示系统的主菜单,里面有相应的功能代码,根据选择各功能代码进入不同的界面。功能主要包括:退出系统、查询图书、借书、还书。 查询图书信息 进入此菜单功能模块,输入您要查询的图书的编号、名字、作者等。 图书查询模

3、块流程如图: 开始 提示输入图书编号、书名、作者 1 输入正确 否 是 是 重新输入 否 3.3 测试结果 系统主界面 退出系统 2 功能菜单 查询系统菜单 3 借还系统菜单 3.4 源代码 # include # include # include typedef struct link char number100; char bookname100; char author100; char publish100; char time100; float price; char status100; struct link *next; 4 link; link *Cbook int n

4、=0; link *p,*q,*head; FILE *fp; fp=fopen(图书信息.txt,r+); if(fp=NULL) printf(没有找到文件,请检查); p=(link *)malloc(sizeof(link); if(p=NULL) printf(申请内存出错!n); fscanf(fp,%s%s%s%s%s,p-number,p-bookname,p-author,p-publish,p-time); fscanf(fp,%f,&p-price); fscanf(fp,%s,p-status); while(feof(fp)=0) n+; if(n=1) head=p

5、; else q=p; p=(link *)malloc(sizeof(link); if(p=NULL) printf(申请内存出错!n); fscanf(fp,%s%s%s%s%s,p-number,p-bookname,p-author,p-publish,p-time); fscanf(fp,%f,&p-price); fscanf(fp,%s,p-status); q-next=p; 5 p-next=NULL; fclose(fp); printf(信息已录入!); return head; void mainmenu printf(n*n); printf(n* 欢迎使用图书管理

6、系统 *n); printf(n* 1.进入系统 0.退出系统 *n); printf(n*n); printf(n 请选择); void menu1 printf(n*n); printf(n* 1.进入图书查询系统 *n); printf(n* 2.进入图书借还系统 *n); printf(n* 3.保存所有图书信息 *n); printf(n* 4.返回上级菜单 *n); printf(n*n); printf(n请选择); void cxmenu printf(n*n); printf(n* 1.显示所有图书信息 *n); printf(n* 2.按编号查询图书 *n); printf

7、(n* 3.按书名查询图书 *n); printf(n* 4.按作者查询图书 *n); printf(n* 5.返回上级菜单 *n); printf(n*n); 6 printf(n请选择); void jhmenu printf(n*n); printf(n* 1.借书 *n); printf(n* 2.还书 *n); printf(n* 3.返回上级菜单 *n); printf(n*n); printf(n请选择); void print(link *head) link *p; p=head; printf(n); printf(n*n); printf(n编号tt书名tt作者tt出版社

8、tt出版时间tt价格tt状态n); while(p!=NULL) printf(n); printf(%st%st%st%st%s,p-number,p-bookname,p-author,p-publish,p-time); printf(tt%.2f,p-price); printf(tt%s,p-status); printf(n); p=p-next; void hold(link *head) 7 link *p; FILE *fp; fp=fopen(图书信息.txt,w+); if(fp=NULL) printf(文件操作出错!); exit(1); p=head; for(;p

9、!=NULL;p=p-next) fprintf(fp,%st%st%st%st%s,p-number,p-bookname,p-author,p-publish,p-time); fprintf(fp,tt%.2f,p-price); fprintf(fp,tt%s,p-status); fprintf(fp,n); fclose(fp); printf(信息已保存。); void holdcx(link *t) link *p=NULL; FILE *fp; fp=fopen(查询.txt,a+); p=t; fprintf(fp,查询到的信息为:n); fprintf(fp,n); fp

10、rintf(fp,n*n); fprintf(fp,n编号tt书名tt作者tt出版社tt出版时间tt价格tt状态n); fprintf(fp,n); fprintf(fp,%st%st%st%st%s,p-number,p-bookname,p-author,p-publish,p-time); 8 fprintf(fp,tt%.2f,p-price); fprintf(fp,tt%s,p-status); fprintf(fp,n); fclose(fp); printf(信息已保存!); link *findnumber(link *head) char key100; link *h,*

11、t1=NULL; printf(请输入图书的编号:); getchar; gets(key); for(h=head;h!=NULL;h=h-next) if(strcmp(key,h-number)=0) t1=h; break; return t1; link *findboookname(link *head) char key100; link *h,*t2=NULL; printf(请输入图书的书名:); getchar; gets(key); for(h=head;h!=NULL;h=h-next) if(strcmp(key,h-bookname)=0) 9 t2=h; brea

12、k; return t2; link *findauthor(link *head) char key100; link *h,*t3=NULL; printf(请输入作者姓名:); getchar; gets(key); for(h=head;h!=NULL;h=h-next) if(strcmp(key,h-author)=0) t3=h; break; return t3; link *sortnumber(link *head) link *p,*q,*temp; temp=(link *)malloc(sizeof(link); if(temp=NULL) printf(申请内存出错

13、!); exit(1); for(p=head;p!=NULL;p=p-next) 10 for(q=p-next;q!=NULL;q=q-next) if(strcmp(p-number,q-number)0) strcpy(temp-number,p-number); strcpy(temp-bookname,p-bookname); strcpy(temp-author,p-author); strcpy(temp-publish,p-publish); strcpy(temp-time,p-time); temp-price=p-price; strcpy(temp-status,p-

14、status); strcpy(p-number,q-number); strcpy(p-bookname,q-bookname); strcpy(p-author,q-author); strcpy(p-publish,q-publish); strcpy(p-time,q-time); p-price=q-price; strcpy(p-status,temp-status); strcpy(q-number,temp-number); strcpy(q-bookname,temp-bookname); strcpy(q-author,temp-author); strcpy(q-publ

15、ish,temp-publish); strcpy(q-time,temp-time); q-price=temp-price; strcpy(q-status,temp-status); return head; link *borrowbook(link *head) link *h,*p; 11 char ch,ch1100=在库,ch2100=不在库; h=head; printf(n*n); printf(tt欢迎使用借书系统!n); p=findboookname(h); if(p=NULL) printf(借书失败,书库中没有这本书!); else if(strcmp(p-sta

16、tus,ch2)=0) printf(借书失败,图书不在库!); else printf(确认借出?Y/N:); scanf(%c,&ch); getchar; if(ch=Y|ch=y) strcpy(p-status,ch2); printf(借书成功,请返回上级菜单保存信息!); if(ch=N|ch=n) printf(你没有借任何书!); return head; link *returnbook(link *head) link *h,*p; char ch,ch1100=在库,ch2100=不在库; h=head; printf(n*n); printf(tt欢迎使用还书系统!n

17、); 12 p=findboookname(h); if(p=NULL) printf(还书失败,这不是本书库的书!); else printf(确认还书?Y/N:); scanf(%c,&ch); getchar; if(ch=Y|ch=y) strcpy(p-status,ch1); printf(还书成功,请返回上级菜单保存信息!); if(ch=N|ch=n) printf(你没有还书!); return head; void main int a,b,c,d; link *h,*t; L:system(cls); mainmenu; while(1) scanf(%d,&a); sw

18、itch(a) case 1: B: system(cls); menu1; 13 while(1) scanf(%d,&b); switch(b) case 1: system(cls); cxmenu; while(1) scanf(%d,&c); switch(c) case 1: print(h); break; case 2: t=findnumber(h); if(t=NULL) printf(没有要查询的图书!); if(t!=NULL) printf(查询的图书为:); printf(n); printf(n*n); printf(n编号tt书名tt作者tt出版社tt出版时间t

19、t价格tt状态n); printf(n); printf(%st%st%st%st%s,t-number,t-bookname,t-author,t-publish,t-time); 14 printf(tt%.2f,t-price); printf(tt%s,t-status); printf(n); break; case 3: t=findboookname(h); if(t=NULL) printf(没有要查询的图书!); if(t!=NULL) printf(查询的图书为:); printf(n); printf(n*n); printf(n编号tt书名tt作者tt出版社tt出版时间

20、tt价格tt状态n); printf(n); printf(%st%st%st%st%s,t-number,t-bookname,t-author,t-publish,t-time); printf(tt%.2f,t-price); printf(tt%s,t-status); printf(n); break; case 4: t=findauthor(h); if(t=NULL) printf(没有要查询的图书!); if(t!=NULL) printf(查询的图书为:); printf(n); 15 printf(n*n); printf(n编号tt书名tt作者tt出版社tt出版时间tt

21、价格tt状态n); printf(n); printf(%st%st%st%st%s,t-number,t-bookname,t-author,t-publish,t-time); printf(tt%.2f,t-price); printf(tt%s,t-status); printf(n); break; case 5: goto B; break; break; case 2: system(cls); jhmenu; while(1) scanf(%d,&d); switch(d) case 1: borrowbook(h); break; case 2: returnbook(h);

22、 16 break; case 3: goto B; break; break; case 3: hold(h); break; case 4: goto L; break; break; case 0: printf(ttt感谢使用,再见!); exit(0); 第四章 心得体会 经过一个多星期的编译原理课程设计,在我的努力下,顺利完成该课程设计。 通过该课程设计,掌握了编译程序工作的基本过程及其各阶 17 段的基本任务,熟悉了编译程序总流程框图,了解了编译程序的生成过程及其相关的技术,对课本上的知识也有了更深的理解。老师常说,课本上的知识是机械的,表面的,要学会去运用,要举一反三。现在终于

23、深刻的了解了这句话。经过这次的课程设计,发现书本上很深奥的知识变的更为简单,同样,对实验原理也了有更深的理解。知道和理解了该理论在计算机中是怎样执行的, 对该理论在实践中的应用有深刻的理解 。通过该课程设计,把死板的课本知识变得生动有趣,激发了学习的积极性。能够把课堂上学的知识通过自己设计的程序表示出来,加深了对理论知识的理解。 课程设计中程序比较复杂,在调试时应该仔细,在程序调试时,注意指针,将不必要的命令去除。除了课堂外,课程设计是最能学到东西的,最考验人的。在做课程设计的这段时间,时刻都感到自己学的知识有多么的贫瘠。经过这次课程设计,让我对C+这门语言有了更深的认识,操作能力有了提高要想是写出的代码能运行,需要耐心细心,毅力以及充沛的体力。只有经过多次编辑,多次编译,再多次运行,才能编写出更好的程序,有时候需要多次的更正才能达到所要的运行结果。 参考文献 谭洁强 C程序设计 清华大学出版社 张基温 C程序设计案例教程 清华大学出版社 王宏 C#程序设计案例教程 清华大学出版社 18

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号