C语言图书管理系统代码

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

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

1、#include<stdio.h>#include<stdlib.h>#include<string.h>struct bookint num;char bname50;char wname20;char press50;char sort50;int time;float price;struct book *next;struct book *creatbook(); /创立链表struct book *addbook(struct book *head); /添加图书int yanzheng(struct book *head,int m); /验证新

2、添加的图书编码是否已存在 void deletebook(struct book *head); /删除图书void fprint(struct book *head); /将链表写入文件struct book *load(); /从文件中读取信息并建成链表 void print_book(struct book *head); /将链表信息输出void chaxun(struct book *head); /查询图书信息void num_chaxun(struct book *head); /按图书编号查询图书 void wname_chaxun(struct book *head); /按

3、作者名查询图书void sort_chaxun(struct book *head); /按类别查询图书void time_chaxun(struct book *head); /按出版时间查询图书void bname_chaxun(struct book *head); /按图书名查询图书void xiugai(struct book *head); /修改图书信息void paixu(struct book *head); /对图书进行排序void num_paixu(struct book *head); /按图书编号排序void time_paixu(struct book *head

4、); /按图书出版时间排序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=1234;char a,d,b10,b110="yjk"struct book *head=NULL;while(y) system("cls");printf("nnnnnnn"

5、);printf(" * 欢送光临 *nn");printf(" * 图书信息管理系统*nnn");printf("nn");printf(" =1-用户登录=n"); printf(" =0-退出系统=n"); printf(" 请输入您的选择:");scanf("%d",&n);printf("n");getchar();switch(n)case 0:y=0;break;case 1:printf(" 请输入您的

6、用户名:");gets(b);printf("n");printf(" 请输入您的密码:");scanf("%d",&c);printf("n");if(strcmp(b,b1)!=0|c!=c1)printf(" 验证失败,请重新输入!n");scanf("%c",&d);getchar();system("cls");elseprintf(" 验证通过!请按Enter键进入!n");scanf("

7、%c",&d);getchar();x=1; while(x)system("cls");printf(" -n");printf(" *图书信息管理系统*n"); printf(" -nn");printf("*nn");printf("*nn");printf(" | 1-添加图书 2-删除图书 |nn");printf(" | 3-图书列表 4-图书排序 |nn");printf(" | 5-查询图书

8、6-修改图书 |nn");printf(" | 7-录入数据 0-退出系统 |nn");printf("*nn");printf("*nn");printf("请输入所选择的序号:");scanf("%d",&choice);getchar();system("cls");switch(choice)case 0:x=0;break;case 1:head=load();if(head=NULL)printf("文件为空,请先录入数据!n"

9、;);getchar();break;elsehead=addbook(head);printf("添加成功!n");printf("是否将新信息保存到文件?(y/n)n");scanf("%c",&a);getchar();switch(a)case n:break;case y:fprint(head);printf("保存成功!n");getchar();break;break; case 2:head=load();if(head=NULL)printf("文件为空,请先录入数据!n&qu

10、ot;); getchar();break; elsedeletebook(head);getchar();break;break;case 3:head=load();if(head=NULL)printf("文件为空,请先录入数据!n"); getchar();break;elseprint_book(head);getchar();break;case 4:head=load();if(head=NULL)printf("文件为空,请先录入数据!n"); getchar();break;elsepaixu(head);getchar();break

11、;case 5:head=load();if(head=NULL)printf("文件为空,请先录入数据!n"); getchar();break;elsechaxun(head);getchar();break;case 6:head=load();if(head=NULL)printf("文件为空,请先录入数据!n");getchar();break;elsexiugai(head);getchar();break;break;case 7:printf("注意:输入图书编码为0时结束!n");head=creatbook();printf("是否将输入的信息保存到文件以覆盖文件中已存在的信息?(y/n)n");getchar();scanf("%c",&a);getchar();switch(a)case n:break;case y:f

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

最新文档


当前位置:首页 > 商业/管理/HR > 商业计划书

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