图书管理系统(含源代码)c语言_数据结构课程设计报告

上传人:第*** 文档编号:56899012 上传时间:2018-10-16 格式:DOCX 页数:28 大小:243.68KB
返回 下载 相关 举报
图书管理系统(含源代码)c语言_数据结构课程设计报告_第1页
第1页 / 共28页
图书管理系统(含源代码)c语言_数据结构课程设计报告_第2页
第2页 / 共28页
图书管理系统(含源代码)c语言_数据结构课程设计报告_第3页
第3页 / 共28页
图书管理系统(含源代码)c语言_数据结构课程设计报告_第4页
第4页 / 共28页
图书管理系统(含源代码)c语言_数据结构课程设计报告_第5页
第5页 / 共28页
点击查看更多>>
资源描述

《图书管理系统(含源代码)c语言_数据结构课程设计报告》由会员分享,可在线阅读,更多相关《图书管理系统(含源代码)c语言_数据结构课程设计报告(28页珍藏版)》请在金锄头文库上搜索。

1、数据结构大作业 121279044 伍杨数据结构大作业数据结构大作业图书管理系统图书管理系统工程管理 121279044 伍杨目录目录一、一、题目要求题目要求1 1二、二、总体设计总体设计2 2三、三、编码实现编码实现2 21)1) 定义图书结构体定义图书结构体 2 22)2) 登记操作登记操作3 33)3) 查看操作查看操作8 84)4) 删除操作删除操作 10105)5) MainMain 函数函数 1919四、四、调试与测试调试与测试 2525五、五、五心得体会五心得体会 2727六、六、用户手册用户手册 2727数据结构大作业 121279044 伍杨一、一、题目要求题目要求1) 目的

2、要求本课程设计任务的目的是要求学生按照分析、设计、编码、调试和测试的软件开发过程独立完成管理系统设计,以及 C 语言算法的掌握,并能最终实现本系统的功能要求,通过这个程序可以学习到以前调试短程序没有的的经验。2) 题目要求实现图书管理信息系统的设计。要求实现图书添加、显示全部图书、查询、借阅和归还。主要考查利用文件的操作!二、二、总体设计总体设计数据结构大作业 121279044 伍杨三、三、编码实现编码实现1) 定义图书结构体struct bookchar bookname20; /书名int NO; /书编号char type20; /类型int date; /到书日期;struct pe

3、rsonchar name10; /姓名char classes20; /班级int number; /学号char telephone12; /联系电话int NO; /书编号char bookname20; /书名int borrowdate; /借书日期int returndate; /还书日期数据结构大作业 121279044 伍杨2) 登记操作void new_book() /登记新书FILE *fp;struct book b;int i,j;if(fp=fopen(“shuku.txt“,“a“)=NULL)printf(“File open error!n“);exit(0);

4、printf(“请朱老师输入此次收到的书本总数:“);scanf(“%d“,for(j=0;ji;数据结构大作业 121279044 伍杨all=i;if(i0in.close();3) 查看操作v void see_book() /查看书库记录FILE *fp;long NO;char bookname20;char type20;long date;数据结构大作业 121279044 伍杨if(fp=fopen(“shuku.txt“,“r“)=NULL)printf(“File open error!n“);exit(0);while(!feof(fp)fscanf(fp,“%s%ld%

5、s%ld“,bookname,printf(“%-10s %-10ld %-10s %ldn“,bookname,NO,type,date);if(fclose(fp)printf(“Can not close the file!n“);exit(0);void see_person() /查看所有借书记录数据结构大作业 121279044 伍杨FILE *fp;char name10; char classes20; int number;char telephone20;int NO; char bookname20; int borrowdate; int returndate; if(

6、fp=fopen(“jieshujilu.txt“,“r“)=NULL)printf(“File open error!n“);exit(0);while(!feof(fp)fscanf(fp,“%s %s %ld %s %ld %s %ld %ld“,name,classes,printf(“%-5s %-5s %ld %-5s %ld %-5s %ld %ldn“,name,classes,number,telephone,NO,bookname,borrowdate,returndate);数据结构大作业 121279044 伍杨if(fclose(fp)printf(“Can not

7、close the file!n“);exit(0);4) 删除操作void delete_books() /删除旧书FILE *fp;struct book b;int number;void deletebooks();printf(“请输入您要删除的书编号:“);scanf(“%d“,if(fp=fopen(“shuku.txt“,“r“)=NULL)数据结构大作业 121279044 伍杨printf(“不能打开此文件!n“);exit(0);while(!feof(fp)fscanf(fp,“%s %d %s %d“,b.bookname,if(b.NO=number)printf(

8、“nnt*图书信息*n“);printf(“nt 图书书名:%25s“,b.bookname);printf(“nt-“);printf(“nt 图书编号:%25d“,b.NO);printf(“nt-“);printf(“nt 图书类型:%23s“,b.type);printf(“nt-“);printf(“nt 到书日期:%25d“,b.date);printf(“nt-“);deletebooks();数据结构大作业 121279044 伍杨void deletebooks()FILE *fp,*fp1,*fp2,*fp3;int number;struct book b;printf(

9、“nn 确认删除?请再次输入书编号:“);scanf(“%d“,if(fp=fopen(“shuku.txt“,“r“)=NULL)printf(“不能打开此文件!n“);exit(0);if(fp1=fopen(“tempshuku.txt“,“w“)=NULL) /建立一个临时文件printf(“不能打开此文件!n“);exit(0);while(!feof(fp)fscanf(fp,“%s %d %s %d“,b.bookname,if(b.NO=number)数据结构大作业 121279044 伍杨continue;elsefprintf(fp1,“%s %d %s %d“,b.boo

10、kname,b.NO,b.type,b.date);fclose(fp);fclose(fp1);if(fp2=fopen(“tempshuku.txt“,“r“)=NULL)printf(“不能打开此文件!n“);exit(0);if(fp3=fopen(“shuku.txt“,“w“)=NULL) /清空书库printf(“不能打开此文件!n“);exit(0);while(!feof(fp2) /将临时文件的内容写人源文件fscanf(fp2,“%s %d %s %d“,b.bookname,fprintf(fp3,“%s %d %s %d“,b.bookname,b.NO,b.type

11、,b.date);数据结构大作业 121279044 伍杨fclose(fp2);fclose(fp3);printf(“n 删除成功!n“);void delete_returnbook() /删除借书记录FILE *fp;int numbers;struct person p;void deletereturnbook();char choice;printf(“n 请输入所还书本的书编号:“);scanf(“%d“,if(fp=fopen(“jieshujilu.txt“,“r“)=NULL)printf(“不能打开此文件!n“);exit(0);数据结构大作业 121279044 伍杨

12、while(!feof(fp)fscanf(fp,“%s %s %ld %s %ld %s %ld %ld“,p.name,p.classes,if(p.NO=numbers)printf(“nt*图书信息*n“);printf(“nt 借书人姓名:%20s“,p.name);printf(“nt-“);printf(“nt 借书人班级:%20s“,p.classes);printf(“nt-“);printf(“nt 借书人学号:%20d“,p.number);printf(“nt-“);printf(“nt 借书人联系电话:%20s“,p.telephone);printf(“nt-“);

13、printf(“nt 图书编号:%24d“,p.NO);printf(“nt-“);printf(“nt 图书名称:%23s“,p.bookname);printf(“nt-“);printf(“nt 借书日期:%25d“,p.borrowdate);printf(“nt-“);printf(“nt 还书日期:%25d“,p.returndate);printf(“nt-“);数据结构大作业 121279044 伍杨deletereturnbook();printf(“nt 您想继续吗?(y/n)“);scanf(“ %c“,if(choice=Y|choice=y)system(“cls“);delete_returnbook();fclose(fp);void deletereturnbook()FILE *fp,*fp1,*fp2,*fp3;struct person p;int numbers;printf(“nn 确认删除?请再次输入书编号:“);scanf(“%d“,数据结构大作业 121279044 伍杨if(fp=fopen(“jieshujilu.txt“,“r“)=NULL)printf(“不能打开此文件!n“);exit(0);if(

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号