c语言超市管理系统报告书Word文档格式.docx
- 文档编号:21009515
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:39
- 大小:192.08KB
c语言超市管理系统报告书Word文档格式.docx
《c语言超市管理系统报告书Word文档格式.docx》由会员分享,可在线阅读,更多相关《c语言超市管理系统报告书Word文档格式.docx(39页珍藏版)》请在冰豆网上搜索。
Xiugai();
5、查询物品信息函数
Chazhao();
6、浏览物品信息函数
Liulan();
7、系统颜色设置函数
yanseshezhi();
8、应用程序退出函数
Jieshu();
3运行环境:
Win2003,WinXP,Win2000,NT,WinME,Win9X
4开发工具和编程语言:
编程语言:
C语言
开发工具:
microsoftvisualC++6.0
5详细设计:
1、结构体变量的定义:
structima
3、文件的初始化:
voidchushihua()
FILE*fp;
structimai={1,"
花生牛奶"
"
湖北武汉"
1200,2.5};
fp=fopen("
ima.dat"
w"
);
if(fp==NULL)
{
printf("
\t\t\t系统错误,请重试........"
exit(0);
}
fwrite(&
i,sizeof(structima),1,fp);
fclose(fp);
}
4、欢迎菜单(主函数):
voidmain()
\n\n"
system("
color1a"
\t\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\n"
\t\3\3\n"
\t\3欢迎使用\3\n"
\t\3超市库存管理系统\3\n"
\t\3按任意键继续\3\n"
\t\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"
getch();
cls"
menu();
chushihua();
5、选择菜单
voidmenu()
intchoice;
\n∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞【超市库存管理系统】∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞\n"
--------------------------------系统菜单显示如下--------------------------------"
\n\t①=====================【新购物品入库】\n"
\n\t②=====================【物品信息删除】\n"
\n\t③=====================【物品信息修改】\n"
\n\t④=====================【物品信息查询】\n"
\n\t⑤=====================【物品信息浏览】\n"
\n\t⑥=====================【系统颜色设置】\n"
\n\t⑦=====================【应用程序退出】\n"
\n\t请输入您要选择的菜单......"
scanf("
%d"
&
choice);
switch(choice)
case1:
Tianjia();
break;
case2:
Shanchu();
case3:
Xiugai();
case4:
Chazhao();
case5:
Liulan();
case6:
yanseshezhi();
case7:
Jieshu();
default:
printf("
\n\t\t\t\t\t输入无效,请您重新输入......"
getch();
system("
menu();
6、新购物品入库函数:
intpanduanID(intid)/*判断所输编号是否已存在*/
{
structimai;
ima.date"
r"
\t\t\t系统错误,请您重试........"
fread(&
while(!
feof(fp))
if(i.id==id)
{
fclose(fp);
return1;
break;
}
fread(&
return0;
voidTianjia()
{structimai;
charchoice;
ab"
labID:
\n\t请您输入要入库物品的信息...\n"
\t\t\t\t物品的编号:
"
i.id);
if(panduanID(i.id)==1)
\t\t\t\t此编号已被使用,请您重新输入......"
gotolabID;
\t\t\t\t物品的名称:
%s"
i.name);
\t\t\t\t物品的生产地:
i.produce);
\t\t\t\t物品的数量:
i.number);
\t\t\t\t物品的单价:
%f"
i.price);
\t\t\t\t\t\t物品信息已入库成功!
!
\n"
\n您想继续吗?
(y/n)"
%c"
if(choice=='
Y'
||choice=='
y'
)
else
7、物品信息删除函数:
voidShanchu()
{structimai[1000];
structimatemp;
intdelID;
charchoice;
intindex=0;
intj=0;
temp,sizeof(structima),1,fp);
i[index]=temp;
index++;
\n\t请输入要删除的物品的编号:
delID);
fopen("
f:
\\ima.date"
for(j=0;
j<
index;
j++)
if(i[j].id!
=delID)
fwrite(&
i[j],sizeof(structima),1,fp);
\t\t\t\t\t物品信息已清除!
8、物品信息修改函数:
voidXiugai()
{intindex=0;
intID,j;
structimai[1000];
\\t\t\t系统错误,请您重试........"
\n\t请输入要修改的信息的物品的编号:
ID);
for(j=0;
=index-1;
=ID)
else
printf("
\t\t物品名称修改为:
scanf("
i[j].name);
\t\t物品生产地修改为:
i[j].produce);
\t\t物品数量修改为:
i[j].number);
\t\t物品单价修改为:
i[j].price);
\t\t\t\t物品信息已修改......"
9、物品信息查询函数:
voidChazhao()
intfindID;
structimai;
{
\t\t\t系统错误,请你重试........"
finID:
\n\t请输入要查询的物品的编号.."
findID);
if(i.id==findID)
\n\n\t***************物品信息******************"
\n\t物品编号...%30d\n"
i.id);
\n\t-----------------------------------------"
\n\t物品名称...%30s\n"
\n\t生产厂家...%30s\n"
\n\t进口数量...%30d\n"
i.number);
\n\t批发价格...%30.3f\n"
i.price);
if(choice=='
{
Chazhao();
}
else
system("
menu();
\t\t\t\t\t输入的编号不存在,请您重新输入......"
gotofinID;
10、物品信息浏览函数:
voidLiulan()
\n\n\t****************物品信息%d*****************"
index);
11、系统颜色设置函数:
voidyanseshezhi()
{inta;
\n\n\t\t选择以下方案\n"
\n\n\t\t1**************红底黑字\n"
\n\n\t\t2**************白底黑字\n"
\n\n\t\t3**************黑底红字\n"
\n\n\t\t4**************绿底蓝字\n"
\n\n\t\t5**************黄底紫字\n"
\n\n\t\t6**************系统默认\n"
\n\n\t\t\t\t\t请挑选您喜爱的颜色<
1-5>
......"
a);
switch(a)
case1:
system("
color40"
case2:
color70"
case3:
color04"
case4:
color21"
case5:
color65"
case6:
default:
\n\n\t\t\t\t\t输入无效,重新输入......"
\n选择的颜色您还满意吗?
(y返回主菜单/n继续选择)"
12、应用程序退出函数:
voidJieshu()
{charchoice;
\n\n\n\n\n\n\n\t\t\t您确定要退出系统吗?
\n\n\n\t\t\t如果您想退出请按'
其它键将返回主菜单....."
\n\n\n\n\n\n\n\n\n\n\t\t\t\t谢谢您的使用!
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
6调试分析:
在此程序的编程前,我上网搜集了一些关于超市管理系统的资料,然后大体决定了编程的大致算法,即利用函数贯穿整个程序,通过SWITCH函数进行各个函数的选择;
同时,进过查阅,我添加了系统颜色设置功能,同是应用了清屏函数,课下讲程序大致写好后,我上机进行了调试;
但却出现了80几处错误,大都是提示miss“;
”beforetybe;
经过分析,程序算法并无错误;
后来询问老师,才发现原来在我所编的程序中,有需要变量时,都是用的时候才定义,但正确的方法是应该在函数的开头就应该将所要用的变量进行生命,否则就出现了编译错误。
7测试结果:
1、欢迎界面
2、系统选择界面:
3、新购物品入库:
4、物品信息删除:
5、物品信息修改:
6、物品信息查询
7、物品信息浏览:
8、系统颜色设置:
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 超市 管理 系统 报告书