C语言图书管理系统源代码.doc

上传人:豆**** 文档编号:33425458 上传时间:2022-08-11 格式:DOC 页数:66 大小:126KB
返回 下载 相关 举报
C语言图书管理系统源代码.doc_第1页
第1页 / 共66页
C语言图书管理系统源代码.doc_第2页
第2页 / 共66页
点击查看更多>>
资源描述

《C语言图书管理系统源代码.doc》由会员分享,可在线阅读,更多相关《C语言图书管理系统源代码.doc(66页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、如有侵权,请联系网站删除,仅供学习与交流C语言图书管理系统源代码【精品文档】第 66 页#include#include#includestruct tushu /*图书结构体*/char num10; /*编号*/char name20; /*书名*/char writer20; /*作者*/char press20; /*出版社*/char kind20; /*类别*/ double time; /*时间*/double price; /*价格*/struct tushu *next;struct stu /*学生结构体*/int snum; /*学号*/char mima10; /*密码

2、*/ struct stu *next;FILE *fp; /*图书文件*/FILE *fp1; /*管理员信息文件*/ FILE *fp2; /*学生信息文件*/void menu(); /*管理员主菜单(管理员进入对图书及学生信息进行管理操作)*/void xmenu(); /*学生主菜单(学生进入可对图书,密码进行操作)*/void gfind(); /*管理员查询(管理员可按一定的方式查询图书)*/void xfind(); /*学生查询(学生可按一定的方式查询图书)*/void secret(); /*管理员权限(管理员登陆所用,输入错误次数过多自动退出)*/void sort();

3、 /*排序(管理员可按一定的方式对图书进行排序,排序完之后可选择文件进行保存)*/void fprint(struct tushu *head); /*保存(可追加的保存,如添加可用)*/void fprint_(struct tushu *head); /*保存(可覆盖保存如修改,删除,排序后用)*/void hfprint(struct tushu *head); /*还书保存(还书成功后自动保存到文件)*/void jfprint_(struct tushu *head); /*借书保存(借书成功之后自动从图书馆删除)*/struct tushu * Input(); /*图书添加(可进

4、行图书的添加)*/struct tushu * create(); /*从文件创建链表(从文件中读出信息,建立单链表)*/void gBrowse(struct tushu *head); /*管理员浏览(对图书进行遍历)*/void xBrowse(struct tushu *head); /*学生浏览(学生对图书进行遍历)*/void count(struct tushu *head); /*统计数量(管理员可对图书进行统计)*/void Findofname(struct tushu *head); /*按书名查找*/void Findofwriter(struct tushu *hea

5、d); /*按作者查找*/void Findofkind(struct tushu *head); /*按类别查找*/void xFindofname(struct tushu *head); /*学生按书名查找*/void xFindofwriter(struct tushu *head); /*学生按作者查找*/void xFindofkind(struct tushu *head); /*学生按类别查找*/void Sort_time(struct tushu * head); /*按时间排序(管理员按时间对图书进行排序,排序完之后可选择文件进行保存)*/void Sort_price(

6、struct tushu * head); /*按价格排序*/void Sort_num(struct tushu * head); /*按编号排序*/void Delete(struct tushu * head,char m15);/*按编号删除(管理员可按编号删除图书)*/void Revise(struct tushu *head); /*修改(管理员可对图书进行修改,并选择是否保存)*/void borrow(struct tushu *head); /*借书*/void huanshu(); /*还书(学生借完书之后进行还书,若没有图书则不能借)*/void gxinxi(); /

7、*管理员信息(有管理员的账号及密码,可进行修改)*/void xmima(struct stu *head1); /*学生密码修改(学生可对自己的密码进行修改)*/struct stu * xcreate(); /*从文件创建学生信息(从文件读出学生信息,建立学生链表)*/void xsecret(struct stu *head1); /*学生权限(学生登陆所用)*/void menu() /*管理员主菜单(管理员进入对图书及学生信息进行管理操作)*/int choice,n=0;struct tushu *head;struct stu *head1,*p;char m15;there:p

8、rintf( n); printf( socat 图书管理系统 n);printf( n);printf( 0退出系统 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排序 n);printf( n);printf( 7修改 n);printf( n);printf( 8删除 n);printf( n);printf( 9修改

9、账号及密码 n);printf( n);printf( 10学生信息 n);printf( n);printf( 请选择:);fflush(stdin);head=create();scanf(%d,&choice);if(choice=1) /help();printf(没有内容!n);system(pause);system(cls);menu();else if(choice=2)system(cls);if(head=NULL)printf(没有图书,请先添加图书!n);system(pause);system(cls);menu();gBrowse(head);else if(cho

10、ice=3)system(cls);count(head);else if(choice=4)system(cls);if(head=NULL)printf(没有图书,请先添加图书!n);system(pause);system(cls);menu();gfind();else if(choice=5)Input();else if(choice=6)system(cls);if(head=NULL)printf(没有图书,请先添加图书!n);system(pause);system(cls);menu();sort(head);else if(choice=7)system(cls);if(

11、head=NULL)printf(没有图书,请先添加图书!n);system(pause);system(cls);menu();Revise(head) ;else if(choice=8)if(head=NULL)printf(没有图书,请先添加图书!n);system(pause);system(cls);menu();printf( 请输入想要删除的图书编号:); scanf(%s,m);Delete(head,m);else if(choice=9)gxinxi();else if(choice=10)system(cls);head1=xcreate();if(head1=NULL

12、)printf(没有学生信息,请到xuesheng_list.txt添加!n);system(pause);system(cls);menu();for(p=head1;p!=NULL;p=p-next)printf(学生学号 密码n);printf(%d %sn,p-snum,p-mima);system(pause);system(cls);menu();else if(choice=0)system(cls);printf(nnnn);printf( 感谢使用图书管理系统 nnn);exit(0);elsesystem(cls);printf(nnnn 输入错误,请重新输入! nnn )

13、;system(pause);system(cls);n+;if(n=3)printf( nnn 你错误次数太多,自动退出! nnn);printf( 感谢使用图书管理系统 nnn);system(pause);exit(0);goto there;void xmenu()/*学生主菜单(学生进入可对图书,密码进行操作)*/ struct tushu *head;struct stu *head1;int choice,n=0;there:printf( n); printf( socat 图书借阅系统 n);printf( n);printf( 0退出系统 n); printf( n);pr

14、intf( 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修改密码 n);printf( n);printf( 请选择:);fflush(stdin);head=create();scanf(%d,&choice);if(choice=1)/xhelp();printf(没有内容!n);system(pause);system(cls);xmenu();else if(choi

15、ce=2)system(cls);if(head=NULL)printf(没有图书!n);system(pause);system(cls);xmenu();xBrowse(head);else if(choice=3)if(head=NULL)printf(没有图书!n);system(pause);system(cls);xmenu();xfind();else if(choice=4)if(head=NULL)printf(没有图书!n);system(pause);system(cls);xmenu();borrow(head);else if(choice=5)huanshu(hea

16、d);else if(choice=6)system(cls);head1=xcreate();if(head1=NULL)printf(学生信息被清空!n);system(pause);system(cls);xmenu();xmima(head1); ;else if(choice=0)system(cls);printf(nnnn);printf( 感谢使用图书管理系统 nnn);exit(0);elsesystem(cls);printf(nnnn 输入错误,请重新输入! nnn );system(pause);system(cls);n+;if(n=3)printf( nnn 你错误

17、次数太多,自动退出! nnn);printf( 感谢使用图书管理系统 nnn);system(pause);exit(0);goto there;void gfind()/*管理员查询(管理员可按一定的方式查询图书)*/int choice,n=0;struct tushu *head;there:system(cls);printf( n);printf( socat 图书借阅系统 n);printf( n);printf( 0返回 n);printf( n);printf( 1按书名查找 n);printf( n);printf( 2按作者查找 n);printf( n);printf(

18、3按类别查找 n);printf( n);printf( n);printf( n);printf( 请选择:);fflush(stdin);head=create();scanf(%d,&choice);if(choice=1)system(cls);Findofname(head);else if(choice=2)system(cls);Findofwriter(head);else if(choice=3)system(cls);Findofkind(head);else if(choice=0)system(cls);menu();elsesystem(cls);printf(nnn

19、n 输入错误,请重新输入! nnn );system(pause);system(cls);n+;if(n=3)printf( nnn 你错误次数太多,自动退出! nnn);printf( 感谢使用图书管理系统 nnn);system(pause);exit(0);goto there;void xfind() /*学生查询(学生可按一定的方式查询图书)*/struct tushu *head;int choice,n=0;there:system(cls);printf( n); printf( socat 图书借阅系统 n);printf( n);printf( 0返回 n); print

20、f( n);printf( 1按书名查找 n);printf( n);printf( 2按作者查找 n);printf( n);printf( 3按类别查找 n);printf( n);printf( n);printf( n);printf( 请选择:);fflush(stdin);head=create();scanf(%d,&choice);if(choice=1)system(cls);xFindofname(head);else if(choice=2)system(cls);xFindofwriter(head);else if(choice=3)system(cls);xFind

21、ofkind(head);else if(choice=0)system(cls);xmenu();elsesystem(cls);printf(nnnn 输入错误,请重新输入! nnn );system(pause);system(cls);n+;if(n=3)printf( nnn 你错误次数太多,自动退出! nnn);printf( 感谢使用图书借阅系统 nnn);system(pause);exit(0);goto there;void sort()struct tushu *head;int choice,n=0;there:system(cls);printf( n); print

22、f( socat 图书借阅系统 n);printf( n); printf( 0返回 n); printf( n); printf( 1按时间排序 n); printf( n); printf( 2按价格排序 n); printf( n); printf( 3按编号排序 n); printf( n); printf( n); printf( n); printf( 请选择:);fflush(stdin);head=create();scanf(%d,&choice);if(choice=1)system(cls); Sort_time(head);else if(choice=2)system

23、(cls);Sort_price(head);else if(choice=3)system(cls);Sort_num(head);else if(choice=0)system(cls);menu();elsesystem(cls);printf(nnnn 输入错误,请重新输入! nnn );system(pause);system(cls);n+;if(n=3)printf( nnn 你错误次数太多,自动退出! nnn);printf( 感谢使用图书借阅系统 nnn); system(pause); exit(0);goto there;struct tushu *Input()stru

24、ct tushu *p1,*p2,*head,*ptr; char num;int x,i=0;system(cls);p1=(struct tushu *)malloc(sizeof(struct tushu); head=p1;p1-price=-1;while(i!=1)printf(请输入编号,以#结束n);scanf(%s,p1-num);if(strcmp(p1-num,#)=0)i=1;while(i!=1)printf(请依次输入书名 作者 出版社 类别 出版时间 价格n);scanf(%s%s%s%s%lf%lf, p1-name,p1-writer,p1-press,p1-

25、kind,&p1-time,&p1-price);p2=p1;p1=(struct tushu *)malloc(sizeof(struct tushu); p2-next=p1;break;if(p1-price!=-1)p2-next=NULL;elsehead=NULL;system(cls);printf(nnnttt图书信息输入结束!nnn);system(pause); system(cls);printf(nnnttt是否保存图书信息?(1.是/2.否):);scanf(%d,&x); if(x=1) fprint(head);else system(cls);printf(nnnttt 文件没有被保存!nnnn);system(pause);system(cls);menu();void fprint(struct tushu *head) struct tushu *p1; if(fp=fopen

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

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

本站为文档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