大一C语言课程设计图书信息管理系统Word文档下载推荐.doc
《大一C语言课程设计图书信息管理系统Word文档下载推荐.doc》由会员分享,可在线阅读,更多相关《大一C语言课程设计图书信息管理系统Word文档下载推荐.doc(16页珍藏版)》请在冰豆网上搜索。
图书信息浏览功能--输出v
查询和排序功能:
(至少一种查询方式)--算法v
l按书名查询
l按作者名查询
图书信息的删除与修改(可选项)v
(2).系统功能与分析(填写你所设计的菜单及流程图)
截图略
流程图:
显示图书记录
返回主菜单
退出
浏览模块流程图
按书名查找模块
1,2,还是3
用户作出选择,输入一整型数值
返回主菜单
返回上一层
按书名查找模块流程图
按作者名称查找模块
返回上一层
按作者查找模块流程图
删除或修改模块
用户作出选择,输入一整型数值
调用删除或修改函数,调用读取函数
用户输入修改或删除信息
用户作出选择,输入1或2或3
1,2或3
2.返回
1.确认
3.返回上一层
插入模块流程图
(3)数据结构
typedefstructbook
{
intsort;
charbook_name[15];
charauthor_name[15];
intvert_number;
charpublish_unit[15];
charpublish_time[10];
intprice;
}B
(4).模块设计
根据功能需要:
源文件
函数名
功能
save()
保存
input()
输入
get()
获取
output()
输出
book_name
通过书名查找
author_name()
通过作者查找
modify()
修改
delet()
删除
(5)总体设计思想:
图书信息管理系统
数据输入
数据浏览
数据查找
删除和修改
(6)调试过程:
测试数据及结果,出现了哪些问题
(7)程序有待改进的地方及本次实习的收获和建议
……
(8)源程序清单(主要代码)
#include<
stdio.h>
stdlib.h>
string.h>
#defineLENsizeof(structbook)
}B;
B*P,*p1,boo;
intnum=0,f=0;
intsave();
voidinput();
intget();
voidoutput();
voidbook_name();
voidauthor_name();
voidmodify();
voiddelet();
intmain()
intre=1,t,j=0;
intn,choice;
while(re==1)
{
t=1;
system("
cls"
);
printf("
*****************************\n"
printf("
主菜单\n\n"
printf("
1.录入信息\n"
2.查看信息\n"
3.查询信息\n"
4.删除与修改信息\n"
5.退出\n"
*****************************"
\n"
if(j==1)printf("
\n\t选择错误!
"
\n\t请选择1-5:
_\b\b"
scanf("
%d"
&
choice);
switch(choice)
{
case1:
{
printf("
\n\t1:
录入信息\n"
input();
\n\t1.返回主菜单;
\n\t2.退出\n\t\t请选择:
scanf("
re);
break;
}
case2:
printf("
\n\t2.查看信息\n"
output();
\n\t1.返回主菜单;
\n\t2.退出\n\t\t请选择:
case3:
while(t==1)
{
printf("
\n\t3.查询信息\n"
printf("
\n\t请选择查询方式:
\n\t1.按书名\n\t2.按作者名\n\t3.其余任意数字键返回主菜单_\b\b"
scanf("
n);
if(n==1)
book_name();
elseif(n==2)
author_name();
else
{
re=1;
gotolebel;
}
\n\t1.返回上一层;
\n\t2.返回主菜单;
\n\t3.退出\n\t请选择:
scanf("
t);
if(t==1)
system("
if(t==2)
re=1;
if(t==3)re=0;
}
lebel:
break;
case4:
while(t==1||f==1)
\n\t4.删除与修改信息\n"
\n\t请选择:
\n\t1.删除信息;
\n\t2.修改信息\n\t3.其余任意数字键返回主菜单_\b\b"
delet();
modify();
gotolebe;
\n\t1.返回上一层;
\n\t2.返回主菜单;
\n\t3.退出\n\t\t请选择:
if(t==1)
if(t==2)re=1;
lebe:
case5:
re=0;
break;
default:
re=1;
j=1;
}
}
return0;
}
intsave()
{
FILE*fp;
inti,n=0,n1=0;
if((fp=fopen("
book.txt"
"
a+"
))==NULL)
return0;
fprintf(fp,"
%d\n"
num);
for(i=0;
i<
num;
i++)
{
fprintf(fp,"
%d%s%s%d%s%s%d"
P[i].sort,P[i].book_name,
P[i].author_name,P[i].vert_number,P[i].publish_unit,P[i].publish_time,P[i].price);
fclose(fp);
return1;
intget()
inti;
fp=fopen("
r"
if(fp==NULL)
else
fscanf(fp,"
num);
if(num>
0)
P=(B*)malloc(LEN*num);
for(i=0;
fscanf(fp,"
%d%s%s%d%s%s%d"
P[i].sort,P[i].book_name,
P[i].author_name,&
P[i].vert_number,P[i].publish_unit,P[i].publish_time,&
P[i].price);
fclo