收藏 分销(赏)

C语言图书标准管理系统源代码.docx

上传人:人****来 文档编号:2882029 上传时间:2024-06-08 格式:DOCX 页数:67 大小:91.87KB 下载积分:14 金币
下载 相关 举报
C语言图书标准管理系统源代码.docx_第1页
第1页 / 共67页
C语言图书标准管理系统源代码.docx_第2页
第2页 / 共67页


点击查看更多>>
资源描述
/*需要在源代码相同目录下创建四个txt文件:tushu_list.txt,jieshu_list.txt,xuesheng_list.txt,guanliyuan.txt*/ #include<stdio.h> #include<stdlib.h> #include<string.h> struct tushu{ /*图书结构体*/ char num[11]; /*编号*/ char name[31]; /*书名*/ char writer[21]; /*作者*/ char press[21]; /*出版社*/ char kind[21]; /*类别*/ double time; /*时间*/ double price; /*价格*/ struct tushu *next; }; struct stu /*学生结构体*/ { int snum; /*学号*/ char mima[11]; /*密码*/ struct stu *next; }; struct jieshu{ /*借书信息结构体*/ int xuehao; /*学生学号*/ char num[11]; /*编号*/ char name[31]; /*书名*/ char writer[21]; /*作者*/ char press[21]; /*出版社*/ char kind[21]; /*类别*/ double time; /*时间*/ double price; /*价格*/ struct jieshu *next; }; int denglu=-1; /*已登录学生学号*/ FILE *fp; /*图书文件*/ FILE *fp1; /*管理员信息文件*/ FILE *fp2; /*学生信息文件*/ FILE *fp3; /*借书信息文件*/ int main(); /*主函数申明*/ struct tushu * create(); /*从文件创建图书链表(从文件中读出图书信息,建立单链表)*/ struct stu * xcreate(); /*从文件创建学生信息(从文件读出学生信息,建立学生链表)*/ struct jieshu * jcreate(); //从文件创建借书信息链表 struct jieshu * borrowcreate(struct tushu *k,struct jieshu *h);//直接创建借书信息链表 struct tushu * Input(); /*图书添加(可进行图书添加)*/ void menu(); /*管理员主菜单(管理员进入对图书及学生信息进行管理操作)*/ void xmenu(); /*学生主菜单(学生进入可对图书,密码进行操作)*/ void gfind(); /*管理员查询(管理员可按一定方法查询图书)*/ void xfind(); /*学生查询(学生可按一定方法查询图书)*/ void secret(); /*管理员权限(管理员登陆所用,输入错误次数过多自动退出)*/ void sort(struct tushu *head); /*排序(管理员可按一定方法对图书进行排序,排序完以后可选择文件进行保留)*/ void fprint(struct tushu *head); /*保留(可追加保留,如添加可用)*/ void jsprint(struct jieshu *h); //将借书信息添加到借书文件 void jfprint_(struct tushu *head); /*借书保留(借书成功以后自动从图书馆删除)*/ void fprint_(struct tushu *head); /*保留(可覆盖保留如修改,删除,排序后用)*/ void gBrowse(struct tushu *head); /*管理员浏览(对图书进行遍历)*/ void xBrowse(struct tushu *head); /*学生浏览(学生对图书进行遍历)*/ void count(struct tushu *head); /*统计数量(管理员可对图书进行统计)*/ void Findofname(struct tushu *head); /*按书名查找*/ void Findofwriter(struct tushu *head); /*按作者查找*/ void Findofkind(struct tushu *head); /*按类别查找*/ void xFindofname(struct tushu *head); /*学生按书名查找*/ void xFindofwriter(struct tushu *head); /*学生按作者查找*/ void xFindofkind(struct tushu *head); /*学生按类别查找*/ void Sort_time(struct tushu * head); /*按时间排序(管理员按时间对图书进行排序,排序完以后可选择文件进行保留)*/ void Sort_price(struct tushu * head); /*按价格排序*/ void Sort_num(struct tushu * head); /*按编号排序*/ void Delete(struct tushu * head,char m[15]);/*按编号删除(管理员可按编号删除图书)*/ void Revise(struct tushu *head); /*修改 (管理员可对图书进行修改,并选择是否保留)*/ void borrow(struct tushu *head); /*借书*/ void huanshu(struct tushu *head); /*还书(学生借完书以后进行还书,若没有图书则不能借)*/ void gxinxi(); /*管理员信息(有管理员账号及密码,可进行修改)*/ void xmima(struct stu *head1); /*学生密码修改(学生可对自己密码进行修改)*/ void xsecret(struct stu *head1); /*学生权限(学生登陆所用)*/ void jsdelete(struct jieshu *h); //学生还书时删除借书统计 void putin(jieshu *h); //将还书信息加入图书文件 /*-------------------------------------------------------------------------------------------------------------------*/ void menu()/*管理员主菜单(管理员进入对图书及学生信息进行管理操作)*/ { int choice,n=0; struct tushu *head; struct stu *head1,*p; char m[15]; there: printf(" ┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf(" ┃ ┃ 图书管理系统 ┃ ┃\n"); printf(" ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃\n"); printf(" ┃ ●[0]退出系统 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[1]返回主菜单 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[2]浏览图书 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[3]统计图书数目 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[4]查询 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[5]添加 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[6]排序 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[7]修改 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[8]删除 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[9]修改账号及密码 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[10]学生信息 ┃\n"); printf(" ┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf(" 请选择:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { system("cls"); printf("\n\n\n\t\t您已退出登录!\n\n\n\n"); system("pause"); main(); } else if(choice==2) { system("cls"); if(head==NULL) { printf("没有图书,请先添加图书!\n"); system("pause"); system("cls"); menu(); } gBrowse(head); } else if(choice==3) { system("cls"); count(head); } else if(choice==4) { system("cls"); if(head==NULL) { printf("没有图书,请先添加图书!\n"); system("pause"); system("cls"); menu(); } gfind(); } else if(choice==5) { Input(); } else if(choice==6) { system("cls"); if(head==NULL) { printf("没有图书,请先添加图书!\n"); system("pause"); system("cls"); menu(); } sort(head); } else if(choice==7) { system("cls"); if(head==NULL) { printf("没有图书,请先添加图书!\n"); system("pause"); system("cls"); menu(); } Revise(head) ; } else if(choice==8) { if(head==NULL) { printf("没有图书,请先添加图书!\n"); system("pause"); system("cls"); menu(); } printf(" 请输入想要删除图书编号:"); scanf("%s",m); Delete(head,m); } else if(choice==9) { gxinxi(); } else if(choice==10) { system("cls"); head1=xcreate(); if(head1==NULL) { printf("没有学生信息,请到xuesheng_list.txt添加!\n"); system("pause"); system("cls"); menu(); } printf("学生学号 密码\n"); for(p=head1;p!=NULL;p=p->next) { printf("%-10d %-10s\n",p->snum,p->mima); } system("pause"); system("cls"); menu(); } else if(choice==0) { system("cls"); printf("\n\n\n\n"); printf(" ━━━━━━━━ 感谢使用图书管理系统 ━━━━━━━━\n\n\n\n\n"); exit(0); } else { system("cls"); printf("\n\n\n\n ━━━━ 输入错误,请重新输入!━━━━ \n\n\n "); system("pause"); system("cls"); n++; if(n==3) { printf(" \n\n\n ━━━━━━━━ 你错误次数太多,自动退出! ━━━━━━━━\n\n\n"); printf(" ━━━━━━━━ 感谢使用图书管理系统 ━━━━━━━━\n\n\n"); system("pause"); exit(0); } goto there; } } //----------------- void xmenu()/*学生主菜单(学生进入可对图书,密码进行操作)*/ { struct tushu *head; struct stu *head1; int choice,n=0; there: printf(" ┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf(" ┃ ┃ 图书借阅系统 ┃ ┃\n"); printf(" ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃\n"); printf(" ┃ ●[0]退出系统 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[1]返回主菜单 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[2]浏览图书 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[3]查询 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[4]借书 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[5]还书 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[6]修改密码 ┃\n"); printf(" ┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf(" 请选择:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { denglu=-1; system("cls"); printf("\n\n\n\t\t您已退出登录!\n\n\n\n"); system("pause"); main(); } else if(choice==2) { system("cls"); if(head==NULL) { printf("没有图书!\n"); system("pause"); system("cls"); xmenu(); } xBrowse(head); } else if(choice==3) { if(head==NULL) { printf("没有图书!\n"); system("pause"); system("cls"); xmenu(); } xfind(); } else if(choice==4) { if(head==NULL) { printf("没有图书!\n"); system("pause"); system("cls"); xmenu(); } borrow(head); } else if(choice==5) { huanshu(head); } else if(choice==6) { system("cls"); head1=xcreate(); if(head1==NULL) { printf("学生信息被清空!!\n"); system("pause"); system("cls"); xmenu(); } xmima(head1); ; } else if(choice==0) { system("cls"); printf("\n\n\n\n"); printf(" ━━━━━━━━ 感谢使用图书管理系统 ━━━━━━━━\n\n\n"); exit(0); } else { system("cls"); printf("\n\n\n\n ━━━━ 输入错误,请重新输入!━━━━ \n\n\n "); system("pause"); system("cls"); n++; if(n==3) { printf(" \n\n\n ━━━━━━━━ 你错误次数太多,自动退出! ━━━━━━━━\n\n\n"); printf(" ━━━━━━━━ 感谢使用图书管理系统 ━━━━━━━━\n\n\n"); system("pause"); exit(0); } goto there; } } //-------------------- void gfind()/*管理员查询(管理员可按一定方法查询图书)*/ { int choice,n=0; struct tushu *head; there: system("cls"); printf(" ┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf(" ┃ ┃ 图书借阅系统 ┃ ┃\n"); printf(" ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃\n"); printf(" ┃ ●[0]返回 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[1]按书名查找 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[2]按作者查找 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[3]按类别查找 ┃\n"); printf(" ┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf(" 请选择:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { system("cls"); Findofname(head); } else if(choice==2) { system("cls"); Findofwriter(head); } else if(choice==3) { system("cls"); Findofkind(head); } else if(choice==0) { system("cls"); menu(); } else { system("cls"); printf("\n\n\n\n ━━━━ 输入错误,请重新输入!━━━━ \n\n\n "); system("pause"); system("cls"); n++; if(n==3) { printf(" \n\n\n ━━━━━━━━ 你错误次数太多,自动退出! ━━━━━━━━\n\n\n"); printf(" ━━━━━━━━ 感谢使用图书管理系统 ━━━━━━━━\n\n\n"); system("pause"); exit(0); } goto there; } } //--------------------- void xfind() /*学生查询(学生可按一定方法查询图书)*/ { struct tushu *head; int choice,n=0; there: system("cls"); printf(" ┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf(" ┃ ┃ 图书借阅系统 ┃ ┃\n"); printf(" ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃\n"); printf(" ┃ ●[0]返回 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[1]按书名查找 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[2]按作者查找 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[3]按类别查找 ┃\n"); printf(" ┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf(" 请选择:"); fflush(stdin); head=create(); scanf("%d",&choice); if(choice==1) { system("cls"); xFindofname(head); } else if(choice==2) { system("cls"); xFindofwriter(head); } else if(choice==3) { system("cls"); xFindofkind(head); } else if(choice==0) { system("cls"); xmenu(); } else { system("cls"); printf("\n\n\n\n ━━━━ 输入错误,请重新输入!━━━━ \n\n\n "); system("pause"); system("cls"); n++; if(n==3) { printf(" \n\n\n ━━━━━━━━ 你错误次数太多,自动退出! ━━━━━━━━\n\n\n"); printf(" ━━━━━━━━ 感谢使用图书借阅系统 ━━━━━━━━\n\n\n"); system("pause"); exit(0); } goto there; } } //------------------- void sort(struct tushu *head) { struct tushu *head2; int choice,n=0; there: system("cls"); printf(" ┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"); printf(" ┃ ┃ 图书借阅系统 ┃ ┃\n"); printf(" ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃\n"); printf(" ┃ ●[0]返回 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[1]按时间排序 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[2]按价格排序 ┃\n"); printf(" ┃ ┃\n"); printf(" ┃ ●[3]按编号排序 ┃\n"); printf(" ┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"); printf(" 请选择:"); fflush(stdin); head2=create(); scanf("%d",&choice); if(choice==1) { system("cls"); Sort_time(head2); } else if(choice==2) { system("cls"); Sort_price(head2); } else if(choice==3) { system("cls"); Sort_num(head2); } else if(choice==0) { system("cls"); menu(); } else { system("cls"); printf("\n\n\n\n ━━━━ 输入错误,请重新输入!━━━━ \n\n\n "); system("pause"); system("cls"); n++; if(n==3) { printf(" \n\n
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 考试专区 > 中考

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服