C语言图书管理系统源代码Word文件下载.docx
- 文档编号:18060520
- 上传时间:2022-12-13
- 格式:DOCX
- 页数:35
- 大小:21.04KB
C语言图书管理系统源代码Word文件下载.docx
《C语言图书管理系统源代码Word文件下载.docx》由会员分享,可在线阅读,更多相关《C语言图书管理系统源代码Word文件下载.docx(35页珍藏版)》请在冰豆网上搜索。
/*图书文件*/
FILE*fp1;
/*管理员信息文件*/
FILE*fp2;
/*学生信息文件*/
voidmenu();
/*管理员主菜单(管理员进入对图书及学生信息进行管理操作)*/
voidxmenu();
/*学生主菜单(学生进入可对图书,密码进行操作)*/
voidgfind();
/*管理员查询(管理员可按一定的方式查询图书)*/
voidxfind();
/*学生查询(学生可按一定的方式查询图书)*/
voidsecret();
/*管理员权限(管理员登陆所用,输入错误次数过多自动退出)*/
voidsort();
/*排序(管理员可按一定的方式对图书进行排序,排序完之后可选择文件进行保存)*/
voidfprint(structtushu*head);
/*保存(可追加的保存,如添加可用)*/
voidfprint_(structtushu*head);
/*保存(可覆盖保存如修改,删除,排序后用)*/
voidhfprint(structtushu*head);
/*还书保存(还书成功后自动保存到文件)*/
voidjfprint_(structtushu*head);
/*借书保存(借书成功之后自动从图书馆删除)*/
structtushu*Input();
/*图书添加(可进行图书的添加)*/
structtushu*create();
/*从文件创建链表(从文件中读出信息,建立单链表)*/
voidgBrowse(structtushu*head);
/*管理员浏览(对图书进行遍历)*/
voidxBrowse(structtushu*head);
/*学生浏览(学生对图书进行遍历)*/
voidcount(structtushu*head);
/*统计数量(管理员可对图书进行统计)*/
voidFindofname(structtushu*head);
/*按书名查找*/
voidFindofwriter(structtushu*head);
/*按作者查找*/
voidFindofkind(structtushu*head);
/*按类别查找*/
voidxFindofname(structtushu*head);
/*学生按书名查找*/
voidxFindofwriter(structtushu*head);
/*学生按作者查找*/
voidxFindofkind(structtushu*head);
/*学生按类别查找*/
voidSort_time(structtushu*head);
/*按时间排序(管理员按时间对图书进行排序,排序完之后可选择文件进行保存)*/
voidSort_price(structtushu*head);
/*按价格排序*/
voidSort_num(structtushu*head);
/*按编号排序*/
voidDelete(structtushu*head,charm[15]);
/*按编号删除(管理员可按编号删除图书)*/
voidRevise(structtushu*head);
/*修改(管理员可对图书进行修改,并选择是否保存)*/
voidborrow(structtushu*head);
/*借书*/
voidhuanshu();
/*还书(学生借完书之后进行还书,若没有图书则不能借)*/
voidgxinxi();
/*管理员信息(有管理员的账号及密码,可进行修改)*/
voidxmima(structstu*head1);
/*学生密码修改(学生可对自己的密码进行修改)*/
structstu*xcreate();
/*从文件创建学生信息(从文件读出学生信息,建立学生链表)*/
voidxsecret(structstu*head1);
/*学生权限(学生登陆所用)*/
voidmenu()/*管理员主菜单(管理员进入对图书及学生信息进行管理操作)*/
intchoice,n=0;
structtushu*head;
structstu*head1,*p;
charm[15];
there:
printf("
┏━┓━━━━━━━━━━━━━━━━━━━┏━┓\n"
);
┃┃socat图书管理系统┃┃\n"
┃┗━━━━━━━━━━━━━━━━━━━┛┃\n"
┃●[0]退出系统┃\n"
┃┃\n"
┃●[1]帮助┃\n"
┃●[2]浏览图书┃\n"
┃●[3]统计图书数目┃\n"
┃●[4]查询┃\n"
┃●[5]添加┃\n"
┃●[6]排序┃\n"
┃●[7]修改┃\n"
┃●[8]删除┃\n"
┃●[9]修改账号及密码┃\n"
┃●[10]学生信息┃\n"
┗━━━━━━━━━━━━━━━━━━━━━━━┛\n"
请选择:
"
fflush(stdin);
head=create();
scanf("
%d"
&
choice);
if(choice==1)
{
/2.否):
x);
if(x==1)
fprint(head);
else
{
system("
cls"
printf("
\n\n\n\t\t\t文件没有被保存!
\n\n\n\n"
pause"
menu();
}
}
voidfprint(structtushu*head)
{
structtushu*p1;
if((fp=fopen("
"
a"
))==NULL)
Fileopenerror!
\n"
exit(0);
if(head==NULL)
没有图书保存!
system("
menu();
for(p1=head;
p1!
=NULL;
p1=p1->
next)/*遍历*/
fprintf(fp,"
%s\t%s\t%s\t%s\t%s\t%.0lf\t%lf\n"
p1->
num,p1->
name,p1->
writer,p1->
press,p1->
kind,p1->
time,p1->
price);
/*将图书信息写入文件*/
fclose(fp);
\n图书信息已成功保存到文件中!
getchar();
}
voidfprint_(structtushu*head)
chara[20];
请输入你保存的文件!
%s"
a);
if((fp=fopen(a,"
w"
))==NULL)
没有图书!
next)
fprintf(fp,"
/*将图书信息写入文件*/
\n图书信息已成功保存到文件%s中!
voidhfprint(structtushu*head)
没有还书!
xmenu();
xmenu();
voidjfprint_(structtushu*head)
structtushu*create()
structtushu*head=NULL,*p,*p1,*p2;
r"
))==NULL)/*先安全打开目录文件*/
while(!
feof(fp))/*读取并创建链表*/
p=(structtushu*)malloc(sizeof(structtushu));
p->
price=-1;
fscanf(fp,"
%s%s%s%s%s%lf%lf"
p->
num,p->
name,p->
writer,p->
press,p->
kind,&
p->
time,&
price);
if(p->
price==-1)
{
free(p);
break;
}
if(head==NULL)
{
head=p;
p1=p;
p1->
next=NULL;
}
else
next=p;
p2=p1;
returnhead;
voidgBrowse(structtushu*head)
编号书名作者出版社类别出版时间价格\n"
%s\t%s\t%s\t%s\t%s\t%.0lf\t%.2lf\n"
voidxBrowse(structtushu*head)
voidcount(structtushu*head)/*统计图书数目*/
intn=0;
n++;
\n此系统统计在内的图书共有%d册。
n);
/*计算并输出图书数目*/
voidFindofname(structtushu*head)/*按书名查询图书*/
inti=0,n;
charb[20];
structtushu*p;
p=head;
\n请输入要查询的图书名称:
b);
while(p!
=NULL)
if(strcmp(p->
name,b)==0)
printf("
\n编号书名作者出版社类别出版时间价格\n"
%s\t%s\t%s\t%s\t%s\t%.0lf\t%.2lf\n"
kind,p->
time,p->
i++;
p=p->
next;
if(i==0)
\n对不起!
没有找到名为《%s》的图书!
\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):
n);
if(n==1)
gfind();
voidFindofwriter(structtushu*head)
\n请输入要查询的图书作者姓名:
writer,b)==0)
if(i==0)
没有找到‘%s’所著的相关图书!
gfind();
voidFindofkind(structtushu*head)
\n请输入您要查询的图书类别:
kind,b)==0)
没有找到类别为‘%s’的图书!
voidxFindofname(structtushu*head)/*按书名查询图书*/
xfind();
voidxFindofwriter(structtushu*head)
voidxFindofkind(structtushu*head)
prin
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 图书 管理 系统 源代码
![提示](https://static.bdocx.com/images/bang_tan.gif)