ImageVerifierCode 换一换
格式:DOCX , 页数:30 ,大小:109.77KB ,
资源ID:12078263      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/12078263.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(小型图书馆管理系统c语言版.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

小型图书馆管理系统c语言版.docx

1、小型图书馆管理系统c语言版课程设计(大作业)报告课程名称: 数据结构课程设计设计题目: 小型图书馆管理系统 院 系: 信息技术学院 班 级: 计算机科学与技术 3班 设 计 者: 学 号: * * * 设计时间: 2012.12.24-28 昆明学院课程设计(大作业)任务书姓 名: 院(系):信息技术学院专 业:计算机科学与技术 学 号:*任务起止日期:2012.12.24-28课程设计题目:小型图书馆管理系统课程设计要求:设计目的:对C语言软件开发有一定的认识,了解并掌握开发的各个流程,以及各功能代码的实现。创建一个图书馆管理系统,可进行还书(插入),排序,查找,借书(删除)操作。设计原理:

2、所有信息存储在一个带头结点的单向链表中,每个结点存储一条图书记录,即结构体(book),其中各域为:书号(number)、书名(title)、作者(writer)、定价(pricing)、出版社(publishinghouse),指针域(next)。系统初始时图书记录为空,由用户录入信息,进行插入(包括创建),排序,查找,删除操作有两种排序算法可选:选择排序和直接插入排序,均由链表实现如输入有错,给出出错提示工作计划及安排:设计工作6学时实现与调试18学时课程设计说明书6学时指导教师签字 年 月 日 课程设计(大作业)成绩学号:20111101 姓名 指导教师:王亚宁课程设计题目:小型图书馆管

3、理系统总结:在实验中我学会了和同学一起合作,共同实现一个系统的编写,我们分工合作,共同完成了在这次课程设计中让我的编程能力得到了一定的提高,让我熟悉了链表的一些操作,但在这个过程中还是有很多地方难以下手,需要同学的帮助。在这个过程中我更加的懂得了团结合作的重要性,学到了很多课本上学不到的东西,并且也锻炼了我的沟通协调能力,相信我会在这样每次的实践活动中提升自己!指导教师评语:成绩:填表时间: 指导教师签名:课程设计(大作业)报告一、题目分析 本题是一个图书馆管理系统,涉及到c语言的一些基本操作,比如,构造结构体,插入,查找等!这个程序包括构造一个结构体,域为:书号,书名,作者,出版商,出版日期

4、。运用文件操作的方式实现文件的保存与调用!用菜单界面来操作整个过程!先写每个功能的程序,然后再组合起来,这样显得调理清晰,不容易乱!二、基本理论 C语言的基本知识,比如结构体的构造,链表的操作,文件的操作三、总体设计函数功能:struct books_list * Create_Books_Doc(); /*新建链表*/ void InsertDoc(struct books_list * head); /*插入*/ void DeleteDoc(struct books_list * head , int num);/*删除*/ void Print_Book_Doc(struct book

5、s_list * head);/*浏览*/ void search_book(struct books_list * head); /*查询*/ void info_change(struct books_list * head);/*修改*/ void save(struct books_list * head);/*保存数据至文件*/四、实验器材Pc机五、方法步骤1. 创建主函数main()2新建数据文件create() 2.1为节点分配内存 2.2创建二进制文件用于存储图书信息 2.3通过一个循环 一次录入图书信息 2.4关闭文件3.编写删除数据纪录函数delete() 3.1打开文件

6、3.2遍历文件找到与指定图书信息匹配的记录 并删除 3.3关闭文件4.编写浏览数据记录函数Print_Book_Doc()4.1打开文件4.2遍历整个数据。并显示在于界面上 4.3保存数据至文件5建立查询函数search_book() 5.1打开文件 5.2遍历整个文件找到与指定图书匹配信息 5.3输出查询到的信息 5.4关闭文件6. 编写修改数据纪录函数info_change() 6.1打开文件 6.2遍历整个文件找到与指定图书信息匹配的记录并修改 6.3关闭文件7.保存后结束整个程序六、成效分析我编写的部分struct books_list char author20; /*作者名*/ c

7、har bookname20; /*书名*/ char publisher20; /*出版单位*/ char pbtime15; /*出版时间*/ char loginnum10; /*登陆号*/ float price; /*价格*/ char classfy10; /*分类号*/ struct books_list * next; /*链表的指针域*/; struct books_list * Create_Books_Doc(); /*新建链表*/void InsertDoc(struct books_list * head); /*插入*/void DeleteDoc(struct b

8、ooks_list * head , int num);/*删除*/void Print_Book_Doc(struct books_list * head);/*浏览*/void search_book(struct books_list * head); /*查询*/void info_change(struct books_list * head);/*修改*/void save(struct books_list * head);/*保存数据至文件*/*新建链表头节点*/struct books_list * Create_Books_Doc() struct books_list *

9、 head; head=(struct books_list *)malloc(sizeof(struct books_list); /*分配头节点空间*/ head-next=NULL; /*头节点指针域初始化,定为空*/ return head; /*保存数据至文件*/void save(struct books_list * head) struct books_list *p; FILE *fp; p=head; fp=fopen(data.txt,w+); /*以写方式新建并打开 data.txt文件*/ fprintf(fp,n); /*向文件输出表格*/ fprintf(fp,登

10、录号 书 名 作 者 出版单位 出版时间 分类号 价格 n); fprintf(fp,n); /*指针从头节点开始移动,遍历至尾结点,依次输出图书信息*/ while(p-next!= NULL) p=p-next; fprintf(fp,%-6.6s%-10.10s%-10.10s%-10.10s%-12.12s%-6.6s%.2f n,p-loginnum,p-bookname,p-author,p-publisher,p-pbtime,p-classfy,p-price); fprintf(fp,n); fclose(fp); printf( 已将图书数据保存到 data.txt 文件n

11、);/*插入*/void InsertDoc(struct books_list *head) /*定义结构体指针变量 s指向开辟的新结点首地址 p为中间变量*/ struct books_list *s, *p; char flag=Y; /*定义flag,方便用户选择重复输入*/ p=head; /*遍历到尾结点,p指向尾结点*/ while(p-next!= NULL) p=p-next; /*开辟新空间,存入数据,添加进链表*/ while(flag=Y|flag=y) s=(struct books_list *)malloc(sizeof(struct books_list); p

12、rintf(n 请输入图书登陆号:); fflush(stdin); scanf(%s,s-loginnum); printf(n 请输入图书书名:); fflush(stdin); scanf(%s,s-bookname); printf(n 请输入图书作者名:); fflush(stdin); scanf(%s,s-author); printf(n 请输入图书出版社:); fflush(stdin); scanf(%s,s-publisher); printf(n 请输入图书出版时间:); fflush(stdin); scanf(%s,s-pbtime); printf(n 请输入图书

13、分类号:); fflush(stdin); scanf(%s,s-classfy); printf(n 请输入图书价格:); fflush(stdin); scanf(%f,&s-price); printf(n); p-next=s; /*将新增加的节点添加进链表*/ p=s; /*p指向尾节点,向后移*/ s-next=NULL; printf( 添加成功!); printf(n 继续添加?(Y/N):); fflush(stdin); scanf(%c,&flag); printf(n); if(flag=N|flag=n) break; else if(flag=Y|flag=y) c

14、ontinue; save(head); /*保存数据至文件*/ return;/*修改操作*/void info_change(struct books_list * head) struct books_list * p; int panduan=0; /*此变量用于判断是否找到书目*/ char temp20; p=head; printf(请输入要修改的书名:); scanf(%s,temp); while(p-next!= NULL) p=p-next; if(strcmp(p-bookname,temp)=0) printf(n 请输入图书登陆卡号:); fflush(stdin)

15、; scanf(%s,p-loginnum); printf(n 请输入图书书名:); fflush(stdin); scanf(%s,p-bookname); printf(n 请输入图书作者名:); fflush(stdin); scanf(%s,p-author); printf(n 请输入图书出版社:); fflush(stdin); scanf(%s,p-publisher); printf(n 请输入图书出版时间:); fflush(stdin); scanf(%s,p-pbtime); printf(n 请输入图书分类号:); fflush(stdin); scanf(%s,p-

16、classfy); printf(n 请输入图书价格:); fflush(stdin); scanf(%f,&p-price); printf(n); panduan=1; if(panduan=0) printf(n 没有图书记录! nn); return;/*删除操作*/void DeleteDoc(struct books_list * head) struct books_list *s,*p; /*s为中间变量,p为遍历时使用的指针*/ char temp20; int panduan; /*此变量用于判断是否找到了书目*/ panduan=0; p=s=head; printf(

17、请输入您要删除的书名:); scanf(%s,temp); /*遍历到尾结点*/ while(p!= NULL) if(strcmp(p-bookname,temp)=0) panduan+; break; p=p-next; if(panduan=1) for(;s-next!=p;) /*找到所需删除卡号结点的上一个结点*/ s=s-next; s-next=p-next; /*将后一节点地址赋值给前一节点的指针域*/ free(p); printf(n 删除成功! n); else /*未找到相应书目*/ printf( 您输入的书目不存在,请确认后输入!n); return;int m

18、ain(void) struct books_list * head; char choice; head=NULL; for(;) /*实现反复输入选择*/ printf( n); printf( socat 图书管理系统 n); printf( n); printf( 1图书信息录入 n); printf( n); printf( 2图书信息浏览 n); printf( n); printf( 3图书信息查询 n); printf( n); printf( 4图书信息修改 n); printf( n); printf( 5图书信息删除 n); printf( n); printf( 6退出

19、系统 n); printf( n); printf( 请选择:); fflush(stdin); scanf(%c,&choice); if(choice=1) if(head=NULL) head=Create_Books_Doc(); InsertDoc(head); else if(choice=2) Print_Book_Doc(head); else if(choice=3) search_book(head); else if(choice=4) info_change(head); else if(choice=5) DeleteDoc(head); else if(choice

20、=6) printf(n); printf( 感谢使用图书管理系统 n); break; else printf( 输入错误,请重新输入!); break; return 0; 程序源代码#include#include#include#includestruct books_list char author20; /*作者名*/ char bookname20; /*书名*/ char publisher20; /*出版单位*/ char pbtime15; /*出版时间*/ char loginnum10; /*登陆号*/ float price; /*价格*/ char classfy1

21、0; /*分类号*/ struct books_list * next; /*链表的指针域*/; struct books_list * Create_Books_Doc(); /*新建链表*/void InsertDoc(struct books_list * head); /*插入*/void DeleteDoc(struct books_list * head , int num);/*删除*/void Print_Book_Doc(struct books_list * head);/*浏览*/void search_book(struct books_list * head); /*

22、查询*/void info_change(struct books_list * head);/*修改*/void save(struct books_list * head);/*保存数据至文件*/*新建链表头节点*/struct books_list * Create_Books_Doc() struct books_list * head; head=(struct books_list *)malloc(sizeof(struct books_list); /*分配头节点空间*/ head-next=NULL; /*头节点指针域初始化,定为空*/ return head; /*保存数据

23、至文件*/void save(struct books_list * head) struct books_list *p; FILE *fp; p=head; fp=fopen(data.txt,w+); /*以写方式新建并打开 data.txt文件*/ fprintf(fp,n); /*向文件输出表格*/ fprintf(fp,登录号 书 名 作 者 出版单位 出版时间 分类号 价格 n); fprintf(fp,n); /*指针从头节点开始移动,遍历至尾结点,依次输出图书信息*/ while(p-next!= NULL) p=p-next; fprintf(fp,%-6.6s%-10.1

24、0s%-10.10s%-10.10s%-12.12s%-6.6s%.2f n,p-loginnum,p-bookname,p-author,p-publisher,p-pbtime,p-classfy,p-price); fprintf(fp,n); fclose(fp); printf( 已将图书数据保存到 data.txt 文件n);/*插入*/void InsertDoc(struct books_list *head) /*定义结构体指针变量 s指向开辟的新结点首地址 p为中间变量*/ struct books_list *s, *p; char flag=Y; /*定义flag,方便

25、用户选择重复输入*/ p=head; /*遍历到尾结点,p指向尾结点*/ while(p-next!= NULL) p=p-next; /*开辟新空间,存入数据,添加进链表*/ while(flag=Y|flag=y) s=(struct books_list *)malloc(sizeof(struct books_list); printf(n 请输入图书登陆号:); fflush(stdin); scanf(%s,s-loginnum); printf(n 请输入图书书名:); fflush(stdin); scanf(%s,s-bookname); printf(n 请输入图书作者名:

26、); fflush(stdin); scanf(%s,s-author); printf(n 请输入图书出版社:); fflush(stdin); scanf(%s,s-publisher); printf(n 请输入图书出版时间:); fflush(stdin); scanf(%s,s-pbtime); printf(n 请输入图书分类号:); fflush(stdin); scanf(%s,s-classfy); printf(n 请输入图书价格:); fflush(stdin); scanf(%f,&s-price); printf(n); p-next=s; /*将新增加的节点添加进链表*/ p=s; /*p指向尾节点,向后移*/ s-next=NULL; printf( 添加成功!); printf(n 继续添加?(Y/N):); fflush(stdin); scanf(%c,&flag); printf(n); if(flag=N|flag=n) break; else if(flag=Y|flag=y) continue; save(head); /*保存数据至文件*

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1