图书信息管理系统Word下载.doc
《图书信息管理系统Word下载.doc》由会员分享,可在线阅读,更多相关《图书信息管理系统Word下载.doc(19页珍藏版)》请在冰豆网上搜索。
intdenglu1(structstudents[],inti);
//学生登陆
intdenglu2();
//管理员登陆
structbook*creatbook();
//创建链表,将文件中的图书信息写入链表
intinputchoice();
//选择菜单
intinputchoice1();
//学生选择菜单
intinputchoice2();
//管理员选择菜单
voidpmenu(structbook*head);
//学生主功能选择菜单
voidmenu2(structbook*head);
//管理员主功能选择菜单
structbook*addbook(structbook*head);
//添加图书信息
intchashu(structbook*head,charm[20]);
//查找分类号是否存在
structbook*insert1(structbook*head,structbook*p);
//增加接点
voidprintbook(structbook*head);
//图书查找
intputchoice();
//选择查找内容
voidchaname1(structbook*head);
//按书名查找
voidchaprice(structbook*head);
//按价格查找
voidchacnum(structbook*head);
//按分类号查找
voidchazuozhe(structbook*head);
//按作者名查询图书信息
voidchatime(structbook*head);
//按出版时间查找
voidchapress(structbook*head);
//按出版社查找
voidsortbook(structbook*head);
//排序选择
voidshuming(structbook*head);
//按图书名排
voidptime(structbook*head);
//按出版时间排序
voidprice1(structbook*head);
//按图书价格排
voidfenleihao(structbook*head);
//按图书编号排序
voidzuo1(structbook*head);
//按作者名排序
voidpre1(structbook*head);
//按出版社排序
structbook*shanchubook(structbook*head);
//删除图书信息
voidfprint(structbook*head);
//将新链表写入文件中
voidxiugai(structbook*head);
//修改图书信息
voidprintbook1(structbook*head);
//浏览全部图书信息
intchacun(structbook*head,charm[20]);
//查找库存量是否为0
intjige();
//求出文件中客户的个数
intxcz(structbook*head,charcnum[20]);
//把库内图书的库存量减一
intxcz1(structbook*head,charcnum[20]);
//把库内图书的库存量加一
voidbackbook(structstudents[],inti,structbook*head);
//还书函数
voidborrowbook(structstudents[],inti,structbook*head);
//借书函数
voidxmima(structstudents[],inti);
//修改密码
voidxwj(structstudents[],inti);
//将修改后的数组写入文件
voidoneself(structstudents[],inti);
//查看个人信息
intjie(charcnum[20],inti,structstudents[],charmnum[20]);
//查询是否借书
inthuan(inti,structstudents[],charmnum[20]);
//借书查询是否借书
图书信息结构体:
structbook{
charbookname[20];
//书名
charename[20];
//作者
charcnum[20];
//图书分类号即图书编号,区别其余图书唯一特征
charpubpress[20];
//出版社
charpubtime[20];
//出版时间
intprice;
//价格
intzc;
//现库存
intxc;
//总库存
structbook*next;
//用链表建立图书信息
};
intdenglu2()//管理员登陆系统
{
FILE*fp;
structxinxi{
charmnum[20];
//管理员登陆账号
charmima[20];
//管理员登录密码
}temp;
charmnum[20],mima[20];
intm,n,i;
for(i=0;
i<
3;
i++)
{
printf("
请输入帐号:
"
);
scanf("
%s"
mnum);
printf("
请输入密码:
scanf("
mima);
if((fp=fopen("
2.txt"
"
r"
))==NULL){
Cannotopenthefile!
exit(0);
}
while(!
feof(fp))
{
fscanf(fp,"
%s%s"
temp.mnum,temp.mima);
m=strcmp(temp.mnum,mnum);
n=strcmp(temp.mima,mima);
if(m==0&
&
n==0)
return1;
fclose(fp);
}
returni;
}
intinputchoice2()//管理员功能选择模块,管理员的所有功能
intmychoice;
printf("
1.图书查询\n2.图书排序\n3.浏览全部图书\n4.添加图书\n5.删除图书\n6.修改图书\n0.退出\n"
\ninputyourchoice:
scanf("
%d"
&
mychoice);
returnmychoice;
}
3、structbook*creatbook(){
structbook*head,*tail,*p;
intsize=sizeof(structbook);
charbookname[20],ename[20],cnum[20],pubpress[20],pubtime[20];
intprice,zc,xc;
head=tail=NULL;
if((fp=fopen("
book.txt"
}
fscanf(fp,"
%s%s%s%s%s%d%d%d"
bookname,ename,cnum,pubpress,pubtime,&
price,&
zc,&
xc);
while(!
feof(fp)){
p=(structbook*)malloc(size);
strcpy(p->
bookname,bookname);
ename,ename);
cnum,cnum);
pubpress,pubpress);
pubtime,pubtime);
p->
price=price;
zc=zc;
xc=xc;
if(head==NULL)
head=p;
else
tail->
next=p;
tail=p;
fscanf(fp,"
fclose(fp);
tail->
next=NULL;
returnhead;
}
structbook*addbook(structbook*head)//添加图书信息
structbook*p;
//分类号
intprice,zc,xc;
//价格,总库存,现库存
intn,i;
printf("
如果您已经添加完毕,请将分类号数输入为0,谢谢合作:
\n"
printf("
1.少量添加,所添加内容没有存在文件中\n2.批量添加,内容在文件中存放\n"
请输入编号:
i);
switch(i){
case1:
请输入图书分类号:
scanf("
cnum);
n=chashu(head,cnum);
if(n==1)
printf("
您输入的分类号已存在,请重新输入!
returnhead;
while(strcmp(cnum,"
0"
)!
=0)
{
n=chashu(head,cnum);
if(