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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

图书管理系统源代码原创Word文件下载.docx

1、 /对图书进行排序void num_paixu(struct book head); /按图书编号排序void time_paixu(struct book head); /按图书出版时间排序void price_paixu(struct book head); /按图书价格排序void bname_paixu(struct book *head); /按图书名排序void wname_paixu(struct book *head); /按作者名排序int main() int choice,n,x,y=1,c,c1=1; char a,d,b10,b110=1”; struct book

2、head=NULL; while(y) system(”cls); printf(”nnnnn); printf( -n printf(” - -|-图书信息管理系统-|-|-n - |- 登陆界面 -|-|-n”); printf( -nn =1-进入系统=n”); printf(” =0退出系统=n”); -n 请输入选择:”); scanf(”%d”,n);n”); getchar(); switch(n) case 0: y=0; break; case 1: 请输入您的用户名(输入1即可):”); gets(b); 请输入您的密码(输入1即可): scanf(d,&c); print

3、f(”n if(strcmp(b,b1)!=0|c!=c1) 验证失败,请重新输入!n”); scanf(”cd); getchar(); system(”cls”); else 验证通过!请按Enter键进入!d); x=1; while(x) system(cls”); system (”color 1F”); printf(” -nn - |-|-图书信息管理系统-|-|nn”); - |-操作界面-|-|nn”); printf(” -nn -n printf(” -|-系统菜单选项-|-n printf(” -n”); - 1-添加图书 删除图书-2 |-nn - 3图书列表 图书排

4、序-4 |-nn”); printf(” | 5-查询图书 修改图书-6 -nn printf(” - 7录入数据 退出系统-0 nn -n”); printf(” -nn”); printf(”请输入所选择的序号:%d,choice); getchar(); system(cls switch(choice) case 0: x=0;break; head=load(); if(head=NULL) printf(”文件为空,请先录入数据! getchar(); break; else head=addbook(head); printf(添加成功!是否将新信息保存到文件?(y/n)n”);

5、 scanf(”%c,a); switch(a) case n: break; case y: fprint(head); printf(保存成功! getchar(); break; case 2: if(head=NULL)文件为空,请先录入数据! getchar(); else deletebook(head); case 3: head=load();文件为空,请先录入数据! print_book(head); case 4: head=load(); if(head=NULL)文件为空,请先录入数据! paixu(head); case 5: printf(”文件为空,请先录入数据!

6、 else chaxun(head); getchar(); case 6:文件为空,请先录入数据! else xiugai(head); break; case 7: printf(注意:输入图书编码为0时结束! head=creatbook();是否将输入的信息保存到文件以覆盖文件中已存在的信息? scanf(c”,a); switch(a) case 0: break; case y保存成功! default: printf(”输入有误,请重新输入! getchar(); break; break; 输入有误,请重新输入! getchar(); /录入数据并形成链表struct book

7、 creatbook() struct book head,*tail,*p; int num,time,n; char bname50,wname20,press50,sort50; float price; int size=sizeof(struct book); head=tail=NULL;请输入图书编号: scanf(”%d,&num); printf(”请输入图书名: scanf(”%s”,bname); printf(”请输入作者名:%s”,wname); printf(”请输入出版社:%s,press); printf(”请输入类别: scanf(”s,sort);请输入出版

8、时间:d”,time);请输入价格:f”,price); while(1) p=(struct book )malloc(size); pnum=num; strcpy(p-bname,bname); strcpy(p-wname,wname); strcpy(p-press,press); strcpy(psort,sort); ptime=time; pprice=price; p-next=NULL; if(head=NULL) head=p; else tailnext=p; tail=p; do printf(”请输入图书编号:%d”,&num); n=yanzheng(head,n

9、um); if(n=0) printf(”您输入的编号已存在,请重新输入! while(1); if(num=0) 请输入图书名: scanf(%s”,bname); printf(”请输入作者名: scanf(”s,wname);请输入出版社:,press); printf(”请输入类别: scanf(”s”,sort);请输入出版时间:,time); printf(”请输入价格:%f”,price); return head;/插入结点,并且插入后仍按一定顺序struct book *addbook(struct book *head) struct book *ptr,*p1,*p2,*

10、p; char bname50,wname20,press50,sort50; int num,time,n=1; do printf(”请输入图书编号:%d”,& n=yanzheng(head,num); printf(”您输入的编号已存在,请重新输入! while(1); printf(”请输入图书名:%s”,bname);s scanf(”%s”,sort); printf(”请输入出版时间: scanf(”%d”,time); printf(”请输入价格:fprice); p=(struct book *)malloc(size); pnum=num; strcpy(pbname,b

11、name); strcpy(pwname,wname); strcpy(p-press,press); strcpy(p-sort,sort); ptime=time; pprice=price; p2=head; ptr=p; while(ptr-nump2num)&(p2-next!=NULL) p1=p2; p2=p2next; if(ptr-numnum) if(head=p2) head=ptr; p1-next=ptr;next=p2; else p2next=ptr;next=NULL;/验证添加的图书编号是否已存在int yanzheng(struct book head,in

12、t m) struct book p; p=head; while(p!=NULL) if(p-num=m) p=p-next; if(p=NULL) return 0; else return 1;/将新链表写入文件中void fprint(struct book *head) FILE *fp; char ch=1; struct book p1; if(fp=fopen(f1。txt,”w”)=NULL)File open error! exit(0); fputc(ch,fp); for(p1=head;p1;p1=p1-next) fprintf(fp,d s %s s %s %d

13、fn”,p1num,p1bname,p1wname,p1-press,p1-sort,p1time,p1-price); fclose(fp);/从文件中读取图书信息struct book *load() char ch; struct book head,tail,*p1; if(fp=fopen(”f1.txt,r”)=NULL)File open error! ch=fgetc(fp); if(ch=1) while(!feof(fp) p1=(struct book )malloc(sizeof(struct book); fscanf(fp,”dsss%s%d%fn”,&p1num,

14、p1-bname,p1wname,p1press,p1sort,&p1time,p1price); head=p1; tailnext=p1; tail=p1; tailnext=NULL; return NULL;/将整个链表的信息输出void print_book(struct book *head) struct book ptr; printf(”n没有信息! return; 图书信息列表如下n”); printf(” =n printf(” 编号 图书名 作者名 出版社 类别 出版时间 价格n for(ptr=head;ptr;ptr=ptrnext) 3d %12s %8s %14

15、s -2s -4d 。2fn”, ptrnum,ptr-bname,ptrwname,ptrpress,ptrsort,ptrtime,ptrprice);/删除图书信息void deletebook(struct book head) int a; char b,ch=; struct book *p1,*p2; FILE *fp;请输入要删除的图书编号: scanf(”d”,a); p1=head; if(p1-num=a&p1-next=NULL) /对于文件中只有一组数据 printf(”是否清空文件! scanf(”%c”,&b); switch(b) case n: case y if(fp=fopen(”f1。w)=NULL) printf(”File open error! fclose(fp);文件已清空! else while(p1-num!=a&p1=NULL) p2=p1; p1=p1next; if(p1next=NULL) if(p1num=a) p2-是否确定从文件中彻底删除该图书?(y/n)n getchar(

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

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