c语言程序设计图书信息管理系统毕业设计文档格式.docx
《c语言程序设计图书信息管理系统毕业设计文档格式.docx》由会员分享,可在线阅读,更多相关《c语言程序设计图书信息管理系统毕业设计文档格式.docx(20页珍藏版)》请在冰豆网上搜索。
#definePRINT3printf("
%12d%8s%8s%8d%8d%8d-%2d-%2d%8s%12s"
books[i].num,books[i].name,books[i].kind,books[i].add,books[i].current_add,books[i].pub_time.year,books[i].pub_time.month,books[i].pub_time.day,books[i].writer,books[i].factory);
intsum;
/*用来记录图书数目*/
/*日期结构体类型*/
structdate
{intyear;
intmonth;
intday;
};
/*图书结构体类型*/
structbooks_type
{intnum;
charname[10];
charkind[10];
intadd;
/*图书总库存量*/
intcurrent_add;
/*图书现库存量*/
structdatepub_time;
charwriter[10];
charfactory[10];
}books[M];
/*存放M种图书记录的结构体数组*/
/*保存信息*/
save_message(intsum)
{FILE*fp;
inti;
if((fp=fopen("
tushuguanli.txt"
"
wb"
))==NULL)
{printf("
读文件错误!
\n"
);
return;
}
for(i=0;
i<
sum;
i++)
if(fwrite(&
books[i],sizeof(structbooks_type),1,fp)!
=1)
printf("
写文件错误!
fclose(fp);
}
/*输入模块*/
input_message()
{inti=0,s=M;
clrscr();
printf("
\n\n录入图书信息(最多%d种)\n"
s);
----------------------------\n"
do
\n第种%d图书"
i+1);
\n图书号:
"
scanf("
%d"
&
books[i].num);
if(books[i].num==0)break;
\n图书名称:
);
%s"
books[i].name);
\n图书种类:
books[i].kind);
\n图书总量:
books[i].add);
\n图书现库存量:
books[i].current_add);
\n出版日期:
%d-%d-%d"
books[i].pub_time.year,&
books[i].pub_time.month,&
books[i].pub_time.day);
\n作者:
books[i].writer);
\n出版商:
books[i].factory);
i++;
}while(i<
M);
\n--%d种图书信息输入完毕!
--\n"
i);
sum=i;
\n按任意键返回主菜单!
bioskey(0);
/*读取信息*/
intread_message()
inti=0;
if((fp=fopen("
rb"
{printf("
\n\n**暂时还没有任何库存信息,按任意键进入主菜单选择基本信息的录入!
****\n"
return0;
while(feof(fp)!
{fread(&
books[i],sizeof(structbooks_type),1,fp);
if(books[i].num==0)break;
elsei++;
fclose(fp);
return(i);
/*输出模块*/
output_message()
{inti=0,j=0,count,page=1;
\n\n--图书信息表--第%d页\n\n"
page);
PRINT2;
PRINT1;
{if(books[i].num!
=0)
{j++;
if(j%page!
{
PRINT3;
else
{PRINT3;
if(books[i+1].num!
按任意键继续!
++page);
}while(books[i].num!
=0);
按任意键返回主菜单!
bioskey(0);
/*添加图书信息*/
insert_message()
{inti=sum,j,flag=0;
charchoice;
\n\n添加一种新图书\n"
-------------------------------------\n"
do
{books[i].num=++sum;
\n新图书号:
books[i].num);
\n新图书名称:
\n出版日期(年-月-日):
\n作者:
\n要继续吗?
(Y/N)"
choice=getch();
if(choice=='
Y'
||choice=='
y'
\n继续!
flag=1;
elseflag=0;
}while(flag==1);
\n按任意键返回主菜单!
/*删除图书信息*/
del_message()
{inti,j,flag=0,f=0;
intsum=read_message();
intdel_num;
{clrscr();
\n\n请输入要删除图书的序号:
del_num);
for(i=0;
{if(books[i].num==del_num)
{books[i].num=0;
break;
if(flag==0)
\n\n该图书不存在!
\n\n要继续删除吗?
(Y\N)"
f=1;
elsef=0;
}while(f==1);
/*修改模块*/
revise_message()
{inti=0,choice,revise_num,flag=0;
\n输入要修改的图书号:
revise_num);
if(books[i].num==revise_num)
\n---图书信息----\n"
\n您要修改哪一项?
\n1.图书名称\n"
\n2.图书种类\n"
\n3.图书总量\n"
\n4.图书现库存量\n"
\n5.日期\n"
\n6.作者\n"
\n7.出版商\n"
\n0.返回主菜单\n"
\n请选择(0-7):
choice);
switch(choice)
{case1:
\n输入修改后的名称:
break;
case2:
\n输入修改后的种类:
case3:
\n输入修改后的图书总量:
case4:
\n输入修改后的库存量:
books[i].current_add);
case5:
\n输入修改后的日期:
case6:
\n输入修改后的作者:
boo