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

上传人:b****6 文档编号:7486526 上传时间:2023-01-24 格式:DOCX 页数:13 大小:148.90KB
下载 相关 举报
C语言图书管理系统源代码.docx_第1页
第1页 / 共13页
C语言图书管理系统源代码.docx_第2页
第2页 / 共13页
C语言图书管理系统源代码.docx_第3页
第3页 / 共13页
C语言图书管理系统源代码.docx_第4页
第4页 / 共13页
C语言图书管理系统源代码.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

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

《C语言图书管理系统源代码.docx》由会员分享,可在线阅读,更多相关《C语言图书管理系统源代码.docx(13页珍藏版)》请在冰豆网上搜索。

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

C语言图书管理系统源代码

 

C语言图书管理系统源代码

/*需要在源代码相同目录下创建四个txt文件:

,,*/

#include<>

#include<>

#include<>

structtushu{/*图书结构体*/

charnum[11];/*编号*/

charname[31];/*书名*/

charwriter[21];/*作者*/

charpress[21];/*出版社*/

charkind[21];/*类别*/

doubletime;/*时间*/

doubleprice;/*价格*/

structtushu*next;

};

structstu/*学生结构体*/

{

intsnum;/*学号*/

charmima[11];/*密码*/

structstu*next;

};

structjieshu{/*借书信息结构体*/

intxuehao;/*学生学号*/

charnum[11];/*编号*/

charname[31];/*书名*/

charwriter[21];/*作者*/

charpress[21];/*出版社*/

charkind[21];/*类别*/

doubletime;/*时间*/

doubleprice;/*价格*/

structjieshu*next;

};

intdenglu=-1;/*已登录学生学号*/

FILE*fp;/*图书文件*/

FILE*fp1;/*管理员信息文件*/

FILE*fp2;/*学生信息文件*/

FILE*fp3;/*借书信息文件*/

intmain();/*主函数声明*/

structtushu*create();/*从文件创建图书链表(从文件中读出图书信息,建立单链表)*/

structstu*xcreate();/*从文件创建学生信息(从文件读出学生信息,建立学生链表)*/

structjieshu*jcreate();/2.否):

");

scanf("%d",&x);

if(x==1)

fprint(head);

else

{

system("cls");

printf("\n\n\n\t\t\t文件没有被保存!

\n\n\n\n");

system("pause");

system("cls");

menu();

}

}

lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*将图书信息写入文件*/

fclose(fp);

system("cls");

printf("\n图书信息已成功保存到文件中!

\n");

system("pause");

system("cls");

getchar();

menu();

}

lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*将图书信息写入文件*/

fclose(fp);

system("cls");

printf("\n图书信息已成功保存到文件%s中!

\n",a);

system("pause");

system("cls");

menu();

}

lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*将图书信息写入文件*/

fclose(fp);

xmenu();

}

lf%.2lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);/*将图书信息写入文件*/

}

fclose(fp);

system("cls");

getchar();

xmenu();

}

lf%.2lf\n",pj->xuehao,pj->num,pj->name,pj->writer,pj->press,pj->kind,pj->time,pj->price);

fclose(fp3);

}

lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);

}

system("pause");

system("cls");

menu();

}

lf\n",p1->num,p1->name,p1->writer,p1->press,p1->kind,p1->time,p1->price);

}

system("pause");

system("cls");

xmenu();

}

lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price);

i++;

}

p=p->next;

}

if(i==0)

{

system("cls");

printf("\n对不起!

没有找到名为《%s》的图书!

\n",b);

system("pause");

}

printf("\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):

");

scanf("%d",&n);

if(n==1)

gfind();

else

{

system("cls");

menu();

}

}

lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price);

i++;

}

p=p->next;

}

if(i==0)

{

system("cls");

printf("\n对不起!

没有找到'%s'所著的相关图书!

\n",b);

system("pause");

}

printf("\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):

");

scanf("%d",&n);

if(n==1)

gfind();

else

{

system("cls");

menu();

}

}

lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price);

i++;

}

p=p->next;

}

if(i==0)

{

system("cls");

printf("\n对不起!

没有找到类别为'%s'的图书!

\n",b);

system("pause");

}

printf("\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):

");

scanf("%d",&n);

if(n==1)

gfind();

else

{

system("cls");

menu();

}

}

lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price);

i++;

}

p=p->next;

}

if(i==0)

{

system("cls");

printf("\n对不起!

没有找到名为《%s》的图书!

\n",b);

system("pause");

}

printf("\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):

");

scanf("%d",&n);

if(n==1)

xfind();

else

{

system("cls");

xmenu();

}

}

lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price);

i++;

}

p=p->next;

}

if(i==0)

system("cls");

printf("\n对不起!

没有找到'%s'所著的相关图书!

\n",b);

system("pause");

printf("\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):

");

scanf("%d",&n);

if(n==1)

xfind();

else

{

system("cls");

xmenu();

}

}

lf\n",p->num,p->name,p->writer,p->press,p->kind,p->time,p->price);

i++;

}

p=p->next;

}

if(i==0)

system("cls");

printf("\n对不起!

没有找到类别为'%s'的图书!

\n",b);

system("pause");

printf("\n\n\n\t\t\t是否继续查找图书信息(1.是/其他.返回):

");

scanf("%d",&n);

if(n==1)

xfind();

else

{

system("cls");

xmenu();

}

}

lf\n",p5->num,p5->name,p5->writer,p5->press,p5->kind,p5->time,p5->price);

system("pause");

system("cls");

printf("\n\n\n\t\t\t是否保存图书信息(1.是/2.否(返回)):

");

scanf("%d",&x);

if(x==1)

fprint_(p1);

else

system("cls");

printf("\n\n\n\t\t\t没有被保存到文件!

\n\n\n\n");

system("pause");

system("cls");

menu();

return;

}

lf\n",p5->num,p5->name,p5->writer,p5->press,p5->kind,p5->time,p5->price);

system("pause");

system("cls");

printf("\n\n\n\t\t\t是否保存图书信息(1.是/2.否(返回)):

");

scanf("%d",&x);

if(x==1)

fprint_(p1);

else

system("cls");

printf("\n\n\n\t\t\t没有被保存到文件!

\n\n\n\n");

system("pause");

system("cls");

menu();

return;

}

lf\n",p5->num,p5->name,p5->writer,p5->press,p5->kind,p5->time,p5->price);

system("pause");

system("cls");

printf("\n\n\n\t\t\t是否保存图书信息(1.是/2.否(返回)):

");

scanf("%d",&x);

if(x==1)

fprint_(p1);

else

system("cls");

printf("\n\n\n\t\t\t没有被保存到文件!

\n\n\n\n");

system("pause");

system("cls");

menu();

return;

}

/2.否(返回)):

");

scanf("%d",&x);

if(x==1)

fprint_(head);

else

system("cls");

printf("\n\n\n\t\t\t并没有被保存到文件!

\n\n\n\n");

system("pause");

system("cls");

menu();

return;

}

/2.否(返回)):

");

scanf("%d",&x);

if(x==1)

fprint_(head);

else

system("cls");

printf("\n\n\n\t\t\t没有被保存到文件!

\n\n\n\n");

system("pause");

system("cls");

menu();

return;

}

lf%.2lf\n",pj->xuehao,pj->num,pj->name,pj->writer,pj->press,pj->kind,pj->time,pj->price);

fclose(fp3);

}

lf%.2lf\n",h->num,h->name,h->writer,h->press,h->kind,h->time,h->price);

fclose(fp);

}

....\n");

getchar();

there:

fflush(stdin);

system("cls");

printf("\n\n\n1:

管理员登陆系统\n\n2:

学生登陆系统\n\n0:

退出\n\n\n\n");

printf("请选择:

");

scanf("%d",&i);

if(i==0)

{

system("cls");

printf("\n\n\n\n*********************************************************************************\n");

printf("感谢使用图书管理系统\n");

printf("*********************************************************************************\n\n\n");

system("pause");

exit(0);

}

elseif(i==1)

{

system("cls");

secret();

}

elseif(i==2)

{

system("cls");

head1=xcreate();

if(head1==NULL)

{

printf("暂没有学生信息,学生不能登录!

\n");

system("pause");

system("cls");

main();

}

xsecret(head1);

}

else

{

printf("\n\n输入错误,请重新输入!

\n\n\n");

system("pause");

system("cls");

j++;

if(j==3)

{

system("cls");

printf("\n\n\n*************************************************************************\n\n");

printf("\n\n\t\t你输入的次数过多,自动退出!

谢谢使用!

\n\n");

printf("\n\n*************************************************************************\n\n");

system("pause");

exit(0);

}

gotothere;

}

}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 语文

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

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