图书管理系统数据结构Word文档格式.docx
- 文档编号:20791297
- 上传时间:2023-01-25
- 格式:DOCX
- 页数:6
- 大小:15.87KB
图书管理系统数据结构Word文档格式.docx
《图书管理系统数据结构Word文档格式.docx》由会员分享,可在线阅读,更多相关《图书管理系统数据结构Word文档格式.docx(6页珍藏版)》请在冰豆网上搜索。
\n\n\t\t^^^^^^^^^^^^^^图书信息表^^^^^^^^^^^^^^"
);
\n\n图书编号---图书名称---所在书库----作者----出版社---数量\n"
while(p!
=NULL)
printf(PT);
p=p->
}
getch();
/*输入模块*/
structbook*creat()
structbook*head,*p1,*p2;
inti=0;
head=p2=(structbook*)malloc(N);
head->
next=NULL;
\n\n\t\t录入图书信息"
\n\t---------------------------------------"
while
(1)
{p1=(structbook*)malloc(N);
\n请输入图书编号(书号为0结束):
"
scanf("
%d"
&
p1->
num);
if(p1->
num!
=0)
\n\n书名所在书库作者出版社图书数量\n"
%s%s%s%s%d"
p1->
name,p1->
where,p1->
author,p1->
pub,&
count);
p2->
next=p1;
p2=p1;
i++;
else
break;
free(p1);
\n\t\t----------------------------------------"
\n\t\t%d种书录入完毕"
i);
returnhead;
/*查找模块*/
voidfind(structbook*p0)
intflag=1;
请输入要查找的书名:
\n"
%s"
name);
for(p=p0;
p;
next)
if(strcmp(p->
name,name)==0)
flag=0;
if(flag)printf("
\n暂无此图书信息\n"
/*删除模块*/
voiddel(structbook*p0)
p=p0;
请输入要删除的书名:
name,name)==0)
p0->
next=p->
/*后续节点连接到前驱节点之后*/
free(p);
\t该书资料已删除."
p0=p;
\n\t无此图书信息。
"
/*增加模块*/
voidinsert(structbook*p0)
p=(structbook*)malloc(N);
\n请输入要增加的图书编号(书号为0退出):
p->
if(p->
if(p0->
next!
=NULL&
&
next->
num==p->
num)/*找到重号*/
\t该书已存在"
{printf("
p->
name,p->
where,p->
author,p->
next=p0->
next=p;
\t已成功插入."
/*修改模块*/
voidmodify(structbook*p0)
intchoice;
请输入要修改的书名:
flag==1)
\n\t请选择要修改的项:
\n\t1.修改图书编号\n"
\n\t2.修改图书所在书库\n"
\n\t3.修改图书作者\n"
\n\t4.修改图书出版社\n"
\n\t5.修改图书库存量\n"
choice);
switch(choice)
case1:
{printf("
\n请输入新的图书编号:
break;
case2:
\n请输入新的图书书库:
where);
case3:
\n请输入新的图书作者:
author);
case4:
{printf("
\n请输入新的图书出版社:
pub);
case5:
\n请输入新的图书库存量:
\n\t该项已成功修改。
\n\t新的图书信息:
}
\n\t暂无此图书信息。
/*读文件*/
structbook*read_file()
structbook*p,*p1,*head=NULL;
FILE*fp;
if((fp=fopen("
library.txt"
"
rb"
))==NULL)
\n\n\n\n\n\t********库文件不存在,请创建!
**********"
returnNULL;
head=(structbook*)malloc(N);
p1=head;
\n已有图书信息:
while(!
feof(fp))
/*开辟空间以存放的取得信息*/
while(fscanf(fp,"
%d%s%s%s%s%d"
num,p->
count)!
=EOF)
p1=p;
fclose(fp);
\n共种%d图书信息"
\n\n\n文件中的信息以正确读出。
按任意键进入主菜单。
return(head);
/*保存文件*/
voidsave(structbook*head)
fp=fopen("
wb"
/*以只写方式打开二进制文件*/
if(fp==NULL)/*打开文件失败*/
\n=====>
打开文件失败!
return;
else
for(p=head->
p!
=NULL;
fprintf(fp,"
%d%s%s%s%s%d\n"
pub,p->
\n\t保存文件成功!
voidmain()
structbook*head=NULL;
intchoice=1;
head=read_file();
if(head==NULL)
\n\t\t**********"
head=creat();
do
system("
cls"
\t\t----------Welcome---------\n"
\n\n\t欢迎您,图书管理员.\n"
\n\n\n\n\n"
\n\t请选择:
\n\t1.查询图书信息\n"
\n\t2.修改图书信息\n"
\n\t3.增加图书信息\n"
\n\t4.删除图书信息\n"
\n\t5.显示所有图书信息\n"
\n\t0.退出系统\n"
find(head);
modify(head);
insert(head);
del(head);
print(head);
case0:
system("
\n\n\n\n\n\t^^^^^^^^^^谢谢使用,再见^^^^^^^^^^!
\n\n"
}while(choice!
=0);
save(head);
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 图书 管理 系统 数据结构