C语言程序设计报告图书馆信息管理系统.pdf

上传人:叶*** 文档编号:36101594 上传时间:2022-08-25 格式:PDF 页数:36 大小:308.04KB
返回 下载 相关 举报
C语言程序设计报告图书馆信息管理系统.pdf_第1页
第1页 / 共36页
C语言程序设计报告图书馆信息管理系统.pdf_第2页
第2页 / 共36页
点击查看更多>>
资源描述

《C语言程序设计报告图书馆信息管理系统.pdf》由会员分享,可在线阅读,更多相关《C语言程序设计报告图书馆信息管理系统.pdf(36页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、2011年第二阶段课程设计成果报告实训项目:程序设计技术课程设计学号: 0112959姓名: 张麦华专业: 信息管理与信息系统实训日期:2011 年 6 月 27 日至 2011 年 7 月 8 日指导教师:舒蔚实训成绩:江西财经大学信息管理学院- 1 -一、 问题概述(对问题背景及主要实现的功能进行简要说明。 )随着图书馆图书的不断增加,图书管理的难度也随之加大,一个好的图书馆图书信息管理系统, 能够使图书管理工作简便, 有条不紊。通过 C 语言学习,我们已经能够完成基本的 C 语言编程,此次实训,是将学习和实践结合,充分感受 C 语言解决实践问题的魅力。此次编写的图书馆信息管理系统,能够实

2、现基本的图书管理功能。它包括图书库的创建,打印图书信息表,录入新图书,修改图书信息,删除图书信息,借书,还书。图书库包含图书的各方面信息,编号,类型,作者,出版社,总数,剩余量等等,并且打印图书信息表。录入,修改,删除这些功能都是对图书库的操作。借书,还书这两项最重要的功能也都能很好的实现。把此系统应用于图书馆的图书管理,能使图书馆的各项工作便捷,可靠的完成。二、 系统目标(主要是对系统技术目标和要求)欢迎界面、主菜单、系统管理功能、图书信息管理、借阅功能模块、其中系统管理功能包括系统管理员添加、删除、修改信息以及用管理员身份登录系统等功能。图书信息管理包括新增图书、修改图书、删除图书、等功能

3、。- 2 -借阅功能模块包括借书功能、还书功能、查询已借图书、查询过期未还图书,其中借书还书功能可以按图书编号信息进行操作。三、 设计的过程及步骤1、需求分析(描述系统需求,既详细分析系统需求和功能)根据题目要求,应当把图书信息用结构体形式输入,再定义一个全局变量和文件指针进行整个程序的运行, 然后把图书信息送到文件中,所以应该提供一个结构体和文件的输入输出等操作;在程序中需实现图书信息录入,浏览,查询,删除和修改等功能的操作,所以需要建立相应的模块来实现;另外还需提供键盘式选择菜单实现功能,在运行时达到所要目的。2、设计文件结构(设计文件结构,并扼要说明设计缘由)此系统根据所要实现的功能,使

4、用的函数等综合考虑,设计了两个,图书信息文件(tushu.red),借还书文件(borrow.red),录入新图书,修改,删除图书等一些操作时在图书信息文件上运行,借还书功能则在借还书文件上运行,同时也要在图书信息文件上运行。两个文件相互结合, 使各个功能很好的实现了, 运用 C 语言的文件功能,也是整个程序的主线。- 3 -3、设计系统功能图(根据需求分析结果和文件结构, 应用结构化分析与设计技术设计功能结构图,如下图所示)4、函数设计( 详细分析每一个子模块的子功能,定义主要的子函数原型,并对每一个函数的功能加以说明)此系统主要有 7 个功能,也就有主要的 7 个函数,他们分别是void

5、shan()/删除图书信息void xiu()/修改图书信息void putin()/录入新图书void print()/打印图书信息表void returned()/还书void books()/创建图书文件图书管理信息系统创建文件信息基本信息管理图书流通管理图书统计借书管理还书管理本月借出统计超期未还统计统计按期归还率按图书类别查询按书名查询按作者名查询图书查询图书管理信息系统图书输入与追加删除图书记录修改图书记录显示图书信息借书统计报表- 4 -void borrowed()/借书其中每一个函数都用到了两个结构体,它们分别是:struct tushuchar bianhao110;cha

6、r bianhao210;char leixing20;char shuming50;char chubanshe50;char writer20;long zongshu;long shengyu;shu;struct bookschar bianhao110;char bianhao210;long nian;long borrowmonth;long borrowday;long returnedmonth;long returnedday;long limittime;char student10;book;四、 实训成果(对自己的最后的实验成果进行概括)- 5 -经过长达 9 天的编

7、写,修改,运行,最后完成时,预想的功能都能比较好的实现。下面是各个功能运行的界面:进入界面 :功能选择界面 :- 6 -录入新图书界面 :还有各个功能各种界面,这里就不一一列出了。五、 实训心得与体会- 7 -此次系统编程,我感受很多,从开始编程时的迷茫,到修改时的烦躁,再到运行时的无奈,最后是成功时无法表达的喜悦和兴奋。每一步都是自己努力走过来的,虽然这个过程比较辛苦,但是现在回过头去想想,这几天还是过得很有意义和价值的。大家都说编程最需要的是耐心,我这次是深有体会,程序刚开始编,满身都是信心和兴趣,到修改的时候,检查一遍又一遍,修改一次有一次还是无法成功运行,这个时候只有耐心才能坚持完成。

8、同时,编程时,会发现许多以前学的概念都记错了,这时候要找出课本重新温习,所以这也是一个不断学习的过程。还有,编程时不能太死板,要实现一个功能其实都会有很多种算法, 我们应边做边学习新的方法。 对于我的不足之处,要实现一个功能时,我总是第一遍编程实现后,就不愿意在深探究下去,这种惰性很不适合做编程工作。总而言之,通过此次 C 语言实践编程,使我对 C 语言的兴趣更加浓厚,也对 C 语言的实践应用更加了解,充分感受到了它的魅力,同时也明白了自身在这方面工作的优势和不足。六、 附录#include#include#include- 8 -struct tushuchar bianhao110;cha

9、r bianhao210;char leixing20;char shuming50;char chubanshe50;char writer20;long zongshu;long shengyu;shu;struct bookschar bianhao110;char bianhao210;long nian;long borrowmonth;long borrowday;- 9 -long returnedmonth;long returnedday;long limittime;char student10;book;void shan()/删除图书信息FILE *fp;int i=0

10、,j,n,m,l;char booknum20;struct tushu tu1000;if(fp=fopen(tushu.txt,r)=NULL)printf(can not open the tushu.txt.n);exit(0);while(fread(&tui,sizeof(shu),1,fp)- 10 -i+;m=i;printf(要删除几本书:);scanf(%d,&n);getchar();for(i=0;in;i+)printf(输入图书编号 2:);gets(booknum);for(j=0;jm;j+)if(strcmp(booknum,tuj.bianhao2)=0)b

11、reak;if(jm)for(l=0;lm;l+)if(strcmp(tuj.bianhao1,tul.bianhao1)=0)- 11 -tul.zongshu-;tul.shengyu-;for(j;jm;j+)tuj=tuj+1;elseprintf(输入有误重新输入n);i-;if(fp=fopen(tushu.txt,w)=NULL)printf(can not open the tushu.txt.n);exit(0);for(i=0;im-n;i+)- 12 -fwrite(&tui,sizeof(shu),1,fp);printf(删除成功! !);void xiu()/修改图

12、书信息FILE *fp;int i=0,m,n;char booknum20,numchar20;struct tushu tu1000;if(fp=fopen(tushu.txt,r)=NULL)printf(can not open the borrow.txt.n);exit(0);while(fread(&tui,sizeof(shu),1,fp)i+;m=i;- 13 -if(fp=fopen(tushu.txt,w)=NULL)printf(can not open the borrow.txt.n);exit(0);printf(要修改几本书:);scanf(%d,&n);get

13、char();for(i=0;in;i+)printf(输入要修改的图书编号 2:);gets(booknum);for(i=0;im;i+)if(strcmp(booknum,tui.bianhao2)=0)break;- 14 -if(im)printf( 输入修改后的nn);printf( 输入编号 1:);gets(tui.bianhao1);printf(n);printf( 编号 2:);gets(tui.bianhao2);printf(n);printf( 类型:);gets(tui.leixing);printf(n);printf( 书名:);gets(tui.shumin

14、g);printf(n);printf( 出版社:);gets(tui.chubanshe);printf(n);- 15 -printf( 作者:);gets(tui.writer);printf(n);printf( 总数:);gets(numchar);printf(n);tui.zongshu=atol(numchar);printf( 剩余:);gets(numchar);printf(n);tui.shengyu=atol(numchar);elseprintf(输入有误n);for(i=0;im;i+)fwrite(&tui,sizeof(shu),1,fp);fclose(fp

15、);- 16 -void putin()/录入新图书char numchar20;FILE *fp;int i=0,m,n;struct tushu tu1000;if(fp=fopen(tushu.txt,r)=NULL)printf(can not open the borrow.txt.n);exit(0);while(fread(&tui,sizeof(shu),1,fp)i+;m=i;- 17 -if(fp=fopen(tushu.txt,w)=NULL)printf(can not open the borrow.txt.n);exit(0);for(i=0;im;i+)fwrit

16、e(&tui,sizeof(shu),1,fp);printf(要录入几本书:);scanf(%d,&n);getchar();for(i=0;in;i+)printf(n);printf( 输入编号 1:);gets(shu.bianhao1);printf(n);- 18 -printf( 编号 2:);gets(shu.bianhao2);printf(n);printf( 类型:);gets(shu.leixing);printf(n);printf( 书名:);gets(shu.shuming);printf(n);printf( 出版社:);gets(shu.chubanshe);

17、printf(n);printf( 作者:);gets(shu.writer);printf(n);printf( 总数:);gets(numchar);printf(n);- 19 -shu.zongshu=atol(numchar);printf( 剩余:);gets(numchar);printf(n);shu.shengyu=atol(numchar);fwrite(&shu,sizeof(shu),1,fp);fclose(fp);void print()/打印图书信息表FILE *fp;if(fp=fopen(tushu.txt,r)=NULL)printf(can not ope

18、n the tushu.txt.n);exit(0);- 20 -puts(_);puts(-);puts(| 编号 1| 编号 2|类型|书名|作者|出版社|总数 |剩余 |);fseek(fp,0L,SEEK_SET);while(fread(&shu,sizeof(shu),1,fp)=1)printf(%-9s%-10s%-10s%-10s%-10s%-10s%-10ld%-10ldn,shu.bianhao1,shu.bianhao2,shu.leixing,shu.shuming,shu.writer,shu.chubanshe,shu.zongshu,shu.shengyu);v

19、oid returned()/还书FILE *fp;int i=0,m,flag=0,j;- 21 -char booknum20;struct books book11000;if(fp=fopen(borrow.txt,r)=NULL)printf(can not open the borrow.txt.n);exit(0);while(fread(&book1i,sizeof(book),1,fp)i+;m=i;if(fp=fopen(borrow.txt,w)=NULL)printf(can not open the borrow.txt.n);exit(0);printf(输入要还的

20、图书编号 2:);- 22 -gets(booknum);for(j=0;jm;j+)if(strcmp(booknum,book1j.bianhao2)=0)flag=1;break;if(flag)flag=0;printf(输入还书月份:);scanf(%ld,&book1i.returnedmonth);printf(输入还书日期:);scanf(%ld,&book1i.returnedday);getchar();for(j=0;jm;j+)- 23 -fwrite(&book1i,sizeof(book),1,fp);elseprintf(输入有误n);fclose(fp);voi

21、d books()/创建图书文件FILE *fp;char numchar50,ch=y;if(fp=fopen(tushu.txt,wt)=NULL)printf(can not open the tushu.txt.n);exit(0);while(ch=y|ch=Y)- 24 -printf(n);printf( 输入编号 1:);gets(shu.bianhao1);printf(n);printf( 编号 2:);gets(shu.bianhao2);printf(n);printf( 类型:);gets(shu.leixing);printf(n);printf( 书名:);get

22、s(shu.shuming);printf(n);printf( 出版社:);gets(shu.chubanshe);printf(n);printf( 作者:);gets(shu.writer);- 25 -printf(n);printf( 总数:);gets(numchar);printf(n);shu.zongshu=atol(numchar);printf( 剩余:);gets(numchar);printf(n);shu.shengyu=atol(numchar);fwrite(&shu,sizeof(shu),1,fp);doprintf(have another book re

23、cord(y/n)?:);gets(numchar);ch=numchar0;while(!(ch=y|ch=n|ch=Y|ch=N);fclose(fp);- 26 -void borrowed()/借书struct tushu tu1000;struct books book11000;FILE *fp,*fq;char numchar50;int i=0,j,m1,m2,n,flag=0,x;printf(借几本书:);scanf(%d,&x);getchar();if(fq=fopen(tushu.txt,r)=NULL)printf(can not open the tushu.tx

24、t.n);exit(0);while(fread(&tui,sizeof(shu),1,fq)- 27 -i+;m1=i;if(fp=fopen(borrow.txt,r)=NULL)printf(can not open the borrow.txt.n);exit(0);while(fread(&book1i,sizeof(book),1,fp)i+;m2=i;for(i=0;ix;i+)printf(n);printf(输入编号 2:);- 28 -gets(numchar);for(j=0;jm1;j+)if(strcmp(numchar,tuj.bianhao2)=0)n=j;fla

25、g=1;break;if(flag)printf(n);printf(输入正确nn);flag=0;strcpy(book.bianhao2,numchar);printf( 输入编号1);gets(book.bianhao1); printf(n);printf( 借书年份:);gets(numchar);printf(n);- 29 -book.nian=atol(numchar);printf( 借书月份:);gets(numchar); printf(n);book.borrowmonth=atol(numchar);printf( 借 书 日 期 :); gets(numchar);

26、 printf(n);book.borrowday=atol(numchar);printf( 还书月份:);gets(numchar); printf(n);book.returnedmonth=atol(numchar);printf( 还书日期:);gets(numchar);printf(n);book.returnedday=atol(numchar);printf( 期 限 :);gets(numchar);printf(n);book.limittime=atol(numchar);printf( 学 生 学 号 :);gets(book.student);printf(n);i

27、f(fp=fopen(borrow.txt,w)=NULL)printf(can not open the borrow.txt.n);exit(0);fwrite(&book,sizeof(book),1,fp);- 30 -for(j=0;jm2;j+)fwrite(&book1j,sizeof(book),1,fp);for(j=0;jm1;j+)if(strcmp(tun.bianhao1,tuj.bianhao1)=0)tuj.shengyu-;if(fq=fopen(tushu.txt,w)=NULL)printf(can not open the tushu.txt.n);exi

28、t(0);for(j=0;jm1;j+)fwrite(&tuj,sizeof(shu),1,fq);- 31 -elseprintf(输入错误n);i-;fclose(fq);fclose(fp);void main()int flag=1;char a20;puts();puts();puts();puts();- 32 -puts();puts();puts(欢迎使用图书信息管理系统);puts();puts();puts();puts();puts();puts(田田);puts(田田);puts(田田);puts(田田);puts();puts();puts();puts();puts

29、(请选择您需要的功能 :);puts();- 33 -puts((直接键入对应数字));puts();puts();puts();puts(1.图书创建);puts();puts(2.打印图书信息表);puts();puts(3.图书追加与录入);puts();puts(4.修改图书信息);puts();puts(5.删除图书信息);puts();puts(6.借书);puts();puts(7.还书);puts();- 34 -puts();puts();puts();puts();puts();puts();while(flag)flag=0;scanf(%s,a);getchar();if(strcmp(a,3)=0)putin();else if(strcmp(a,1)=0)books();else if(strcmp(a,6)=0)borrowed();else if(strcmp(a,2)=0)- 35 -print();else if(strcmp(a,7)=0)returned();else if(strcmp(a,4)=0)xiu();else if(strcmp(a,5)=0)shan();elseprintf(输入错误请重新输入:);flag=1;

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

当前位置:首页 > 应用文书 > 公文通知

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

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com