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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

小型图书管理系统C语言程序.docx

1、小型图书管理系统C语言程序小型图书管理系统C语言程序#include#include#includestruct book char writer20; char title20; char publishinghouse20; char number10; float price; struct book * next;struct book * Create_Book();void Insert(struct book * head);void Delete(struct book * head);void Print_Book(struct book * head);void searc

2、h_book(struct book * head);void change_Book(struct book * head);void save(struct book * head);struct book * Create_Book() struct book * head; head=(struct book *)malloc(sizeof(struct book); head-next=NULL; return head;void save(struct book * head) struct book *p; FILE *fp; p=head; fp=fopen(kucun.txt

3、,w+); fprintf(fp,*n); fprintf(fp,书号t 书名t 作者t 出版社t 价格t n); fprintf(fp, n); while(p-next!= NULL) p=p-next; fprintf(fp,%st %st %st %st %.2ft n,p-number,p-title,p-writer,p-publishinghouse,p-price); fprintf(fp,*n); fclose(fp); printf( 已将图书数据保存到 kucun.txt 文件n);/插入/void Insert(struct book *head) struct boo

4、k *s, *p,*p1,*swap; char flag=Y; swap=(struct book *)malloc(sizeof(struct book); p1=swap; p=head; while(flag=Y|flag=y) s=(struct book *)malloc(sizeof(struct book); printf(n 请输入图书书号:); fflush(stdin); scanf(%s,s-number); printf(n 请输入图书书名:); fflush(stdin); scanf(%s,s-title); printf(n 请输入图书作者名:); fflush

5、(stdin); scanf(%s,s-writer); printf(n 请输入图书出版社:); fflush(stdin); scanf(%s,s-publishinghouse); printf(n 请输入图书价格:); fflush(stdin); scanf(%f,&s-price); printf(n);/排序/ p1=p-next; if(head-next!=NULL) do if(strcmp(p1-number),(s-number)0) strcpy(swap-number,p1-number); strcpy(swap-title,p1-title); strcpy(s

6、wap-writer,p1-writer); strcpy(swap-publishinghouse,p1-publishinghouse); swap-price=p1-price; strcpy(p1-number,s-number); strcpy(p1-title,s-title); strcpy(p1-writer,s-writer); strcpy(p1-publishinghouse,s-publishinghouse); p1-price=s-price; strcpy(s-number,swap-number); strcpy(s-title,swap-title); str

7、cpy(s-writer,swap-writer); strcpy(s-publishinghouse,swap-publishinghouse); s-price=swap-price; p=p1; p1=p-next; while(p1!=NULL); p-next=s; 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(

8、head);/查找/void search_book(struct book *head) struct book * p; char temp20; p=head; if(head=NULL | head-next=NULL) printf( * 图书库为空!*n); else printf(请输入您要查找的书名: ); fflush(stdin); scanf(%s,temp); while(p-next!= NULL) p=p-next; if(strcmp(p-title,temp)=0) printf(n图书已找到!n); printf(n); printf(书号: %stn,p-n

9、umber); printf(书名: %stn,p-title); printf(作者名: %stn,p-writer); printf(出版社: %stn,p-publishinghouse); printf(价格: %.2ftn,p-price); if(p-next=NULL) printf(n查询完毕!n); void Print_Book(struct book * head) struct book * p; if(head=NULL | head-next=NULL) printf(n * 没有图书记录! *nn); p=head; printf(*n); printf( 书号t

10、书名t作者t出版社t价格tn); printf(*n); while(p-next!= NULL) p=p-next; printf(%st%st%st%st%.2ftn,p-number,p-title,p-writer,p-publishinghouse,p-price); printf(*n); printf(n);/更改/void change_Book(struct book * head) struct book * p; int panduan=0; char temp20; p=head; printf(请输入要修改图书的书号:); scanf(%s,temp); while(

11、p-next!= NULL) p=p-next; if(strcmp(p-number,temp)=0) printf(n 请输入图书书名:); fflush(stdin); scanf(%s,p-title); printf(n 请输入图书作者名:); fflush(stdin); scanf(%s,p-writer); printf(n 请输入图书出版社:); fflush(stdin); scanf(%s,p-publishinghouse); printf(n 请输入图书价格:); fflush(stdin); scanf(%f,&p-price); printf(n); pandua

12、n=1; if(panduan=0) printf( n*没有图书记录!*nn);/删除/void Delete(struct book *head) struct book *s,*p; char temp20; int panduan; panduan=0; p=s=head; printf( 请输入您要删除的书名:); scanf(%s,temp); p=p-next; while(p!= NULL) if(strcmp(p-title,temp)=0) panduan=1; break; p=p-next; if(panduan=1) while(s-next!=p) s=s-next

13、; s-next=p-next; free(p); printf(n * 删除成功!*n); save(head); else printf( 您输入的书目不存在,请确认后输入!n); /主函数/void main() struct book * head; int choice; head=NULL; while(1) printf( *n); printf( * 小型图书管理系统 *n); printf( * *n); printf( * 1图书信息录入 *n); printf( * *n); printf( * 2图书信息浏览 *n); printf( * *n); printf( *

14、3图书信息查询 *n); printf( * *n); printf( * 4图书信息修改 *n); printf( * *n); printf( * 5图书信息删除 *n); printf( * *n); printf( * 6退出系统 *n); printf( *n); printf( 请选择:); fflush(stdin); scanf(%d,&choice); switch (choice) case 1: if(head=NULL) head=Create_Book(); Insert(head); break; case 2: Print_Book(head); break; case 3: search_book(head); break; case 4: change_Book(head); break; case 5: Delete(head); break; case 6: printf(n); printf( * 感谢使用图书管理系统 *n); break; default: printf( * 输入错误,请重新输入!*); break;

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

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