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

上传人:ni****g 文档编号:398566560 上传时间:2023-01-09 格式:DOC 页数:11 大小:41.50KB
返回 下载 相关 举报
C语言图书馆管理系统源代码_第1页
第1页 / 共11页
C语言图书馆管理系统源代码_第2页
第2页 / 共11页
C语言图书馆管理系统源代码_第3页
第3页 / 共11页
C语言图书馆管理系统源代码_第4页
第4页 / 共11页
C语言图书馆管理系统源代码_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《C语言图书馆管理系统源代码》由会员分享,可在线阅读,更多相关《C语言图书馆管理系统源代码(11页珍藏版)》请在金锄头文库上搜索。

1、#include #include #include #include #includetypedef int BOOL;typedef struct bookinfo char number15;/*产品编号*/ char name30;/*产品名称*/ float price;/*单价*/ char auther20;/*作者*/ BOOL isExit;/*存在状态*/ char lendername20;/*借书人姓名*/ char lendersex2;/*借书人性别*/ char lendernum15;/*借书人学号*/BOOKINFO;void menu() printf(nn

2、nnnnn); printf(ttt图书管理系统n); printf(ttt1:新进图书基本信息的输入n); printf(ttt2:显示全部记录n); printf(ttt3:依据图书名称查询图书基本信息n); printf(ttt4:依据图书名称对撤销的图书信息进行删除n); printf(ttt5:依据图书名称从小大到排序n); printf(ttt6:统计某价格以上的图书数量n); printf(ttt7:列出全部未借出去的图书信息n); printf(ttt8:退出n); void choice_1_input_new()/*输入新进的图书信息*/ char choice; FILE

3、 *p; BOOKINFO newbook; system(cls); while(1) printf(输入图书编号:); gets(newbook.number); printf(输入图书名称:); gets(newbook.name); printf(输入图书单价:); scanf(%f,&newbook.price); while(getchar()!=n); printf(输入图书的作者:); gets(newbook.auther); printf(输入借书人姓名:); gets(newbook.lendername); printf(输入借书人性别:); gets(newbook.

4、lendersex); printf(输入借书人学号:); gets(newbook.lendernum); printf(是否保存该条书目?(Y/N)n); choice=getch(); while(choice!=Y&choice!=y&choice!=N&choice!=n) choice=getch(); if(choice=Y|choice=y) newbook.isExit=1;/*将图书状态设置成1,表示没有借出*/ p=fopen(c:bookinfo.data,ab); fwrite(&newbook,sizeof(BOOKINFO),1,p); fclose(p); pr

5、intf(n该条书目已添加到c:bookinfo.data文件中!n); else printf(n本条书目未保存!n); printf(n是否接着添加书目?(Y/N)n); choice=getch(); while(choice!=Y&choice!=y&choice!=N&choice!=n) choice=getch(); if(choice=Y|choice=y) continue; else break; void choice_2_display_all()/*显示全部图书信息*/ FILE *p; int n; BOOKINFO bookinfo100; int booknum

6、ber=0; system(cls); p=fopen(c:bookinfo.data,rb); while(!feof(p) fread(&bookinfobooknumber,sizeof(BOOKINFO),1,p); booknumber+; /*booknumber-;运用feof()函数会多读一行,因此须要booknumber自减一次,使书目的数量正确*/ fclose(p); booknumber-; if(booknumber=0) printf(没有任何图书信息!nn); else n=0; printf( 图书信息如下n); printf( 图书信息 | 借书人信息 n);

7、 printf(编号 名称 单价 作者 图书状态 | 姓名 性别 学号n); while(nbooknumber) printf(%-6s%-12s%-8.1f%-8s%-9d| %-12s%-8s%-8sn, bookinfon.number,bookinfon.name,bookinfon.price, bookinfon.auther,bookinfon.isExit,bookinfon.lendername, bookinfon.lendersex,bookinfon.lendernum); n+; printf(nn按随意键回到主菜单!n); getch(); void choice

8、_3_search_according_name()/*依据图书名称显示图书的信息*/ char search20=;/*search用来存放要查询的书名*/ int n; FILE *p; char choice; BOOKINFO bookinfo100; int booknumber=0; system(cls); p=fopen(c:bookinfo.data,rb); while(!feof(p) fread(&bookinfobooknumber,sizeof(BOOKINFO),1,p); booknumber+; booknumber-;/*运用feof()函数会多读一行,因此须要booknumber自减一次,使书目的数量正确*/ fclose(p); while(1) printf(输入要查询的书本名称:); gets(search); if(booknumber=0) printf(书库中没有任何信息!nn); printf(按随意键回到主菜单!nn); getch(); break; /*if结束*/ else for(n=0;n=booknumber) printf(没有查找该书的任何信息!n); printf(nn是否接着查询?(Y/N)n); choice=getch(); while(cho

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

最新文档


当前位置:首页 > 办公文档 > 活动策划

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