C语言图书管理系统课程设计之经典.docx
《C语言图书管理系统课程设计之经典.docx》由会员分享,可在线阅读,更多相关《C语言图书管理系统课程设计之经典.docx(10页珍藏版)》请在三一办公上搜索。
1、C语言图书管理系统课程设计之经典题目: 图书管理系统 要求: 能录入新图书; 能浏览图书信息; 能自主查询图书信息; 能修改图书信息; 能删除图书信息。 程序如下: #include #include #include typedef struct char number10;/书号 char name20;/书名 char author20;/作者 char publish50;/出版社 char time20;/出版时间 float price; mbook; typedef struct int count;/书的本数 mbook book100;/最大可有100本书 mlibrary;
2、 mlibrary library; void save/保存图书信息。 void putin /*定义录入函数*/ FILE *fp; if(fp=fopen(library.doc,w)=NULL) fwrite(&library.count,sizeof(int),1,fp); fwrite(library.book,sizeof(library.book0),library.count,fp); printf(n不能保存图书信息n); return; int y=1; system(cls); while(y) printf(t请输入您的书籍的书号:); scanf(%s,librar
3、y.booklibrary.count.number); printf(t请输入书名:); scanf(%s,library.booklibrary.count.name); printf(t请输入作者名:); scanf(%s,library.booklibrary.count.author); printf(t请输入出版社:); scanf(%s,library.booklibrary.count.publish); printf(t请输入出版时间:); scanf(%s,library.booklibrary.count.time); printf(t请输入该书的价格:); fflush
4、(stdin); scanf(%f,&library.booklibrary.count.price); library.count+; printf(n是否继续录入(1.继续;0,退出录入):); fflush(stdin); scanf(%d,&y); if (y!=1) y=0; break; save; void lookup printf(%st%st%st%st%st%6.2fn,library.booki.number,library.printf(图书号t图书名t作者名t出版社t出版日期t图书价格n); for (int i=0;ilibrary.count;i+) syste
5、m(cls); booki.name,library.booki.author,library.booki.publish,library.booki.time,library.booki.price); fflush(stdin); getchar; void search_by_name /*定义按书名查询*/ char s220; int flag=1; printf(n请输入要查询的书名: ); fflush(stdin); scanf(%s,s2); printf(图书号t图书名t作者名t出版社t出版日期t图书价格n); for(int i=0;ilibrary.count;i+ )
6、 printf(%st%st%st%st%st%6.2fn,library.booki.number,library.if(strcmp(s2,library.booki.name)=0) flag=0; booki.name,library.booki.author,library.booki.publish,library.booki.time,library.booki.price); if (flag) fflush(stdin); getchar; printf(cannot found!); void search_by_author /*定义按作者名查询*/ char s320;
7、 int flag=1; printf(请输入要查询的书的作者: ); fflush(stdin); scanf(%s,s3); printf(图书号t图书名t作者名t出版社t出版日期t图书价格n); for(int i=0;ilibrary.count;i+ ) if(strcmp(s3,library.booki.author)=0) flag=0; printf(%st%st%st%st%st%6.2fn,library.booki.number,library.booki.name,library.booki.author,library.booki.publish,library.b
8、ooki.time,library.booki.price); void search /*定义查询函数*/ int a; system(cls); /*进行清屏*/ if (flag) printf(cannot found!); fflush(stdin); getchar; printf(tt*n); printf(开始查询n); printf(ttt1-search_by_namen); printf(ttt2-search_by_writern); printf(ttt0-exitn); printf(tt*n) ; printf(tt请选择你想要的查询方式:); fflush(st
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 图书 管理 系统 课程设计 经典
链接地址:https://www.31ppt.com/p-3155208.html