- 85
- 0
- 约3.73千字
- 约 7页
- 2021-12-09 发布于河北
- 举报
PAGE
PAGE #
商店销售管理系统
^include stdio. h
^include time. h
Mefine N 1000 //N代表货物的最大种类
struct goods
(
char name[10] ;//商品名称 int amount; //商品数量 int num;//商品编号 float price;//商品价格
}sp[N], sc[N];
〃定义全局变量
int flag=l:
FILE *fp;
int i=0;
int k=0;
int b二0: chakanO 〃显示目前的库存
(
int zong=0;
fp=fopenCchaoshi. txt”, r);
for(i=l;i=(k+b);i++)
fread(sp[iZ, sizeof(struct goods), 1, fp);
fclose(fp);
for(i=l;i=k;i++)
(
zong=zong+sp[i]. num;
}
if(zong!=0)
{
数量printf(〃 目前库存情况为:名称
数量
价格 编号\n〃);
for(i=l;i=(k+b):i++)
printf C %s %d
%f %d\n, spLi]. name, sp_i]? amount, spLi]. price, sp.il. num);
}
}
else printf C*\n ##### 目前库存为;
} jinhuo()//进货模块
{
do
{
k++;
i++:
printf C 请输入商品的名称.数量.价格.标号
(0)例如:a 1 2.5 lll\n\t\t\t*);
scanf(^%s %d %f %d%c, sp[i]. name, sp[i]. amount, sp[i]. price,sp[i]. num );
printf 是否继续,是(1),否(0八n\t\t\t);
scanf f lag);
}while(flag!=0);
fp=fopen(^chaoshi. txt, w”);
for(i=l;i=k;i++)
fwrite(sp[i], sizeof(struct goods), 1, fp);
fclose(fp);
chakanO ;
) xiaoshou () //销售模块 (
float m[100];
int z=l;
int j[100];
int a[100];
int g二0;
int y=0;
int h=0;
float zong二0;
fp=fopen(z,chaoshi. txt”, ;
for(i=l;i=k;i++)
fread(sp_i_, sizeof(struct goods), 1, fp);
fclose(fp);
do
{
g++;
y++;
loop: printf( 请输入商品编号和数量’例如:(100
20)\n\t\t\t);
scanf C%d %d〃, j [y], a [y]);
for(z=l;z=k;z++)
(
if (j[y]=sp[z]. num)
{
h++;
sp[z]? amount=sp[z]. amount一a[y];
mLy] = (float)a[y]*spLz]. price;
sc [y]=sp[z];
}
}
if(h=0)
(
printf C 输入有误,请重新输入
\n\t\t\t);
goto loop;
}
fp=fopen (z/chaoshi. txt”, ;
for(i=l:i=k:i++)
fwrite(sp_i], sizeof(struct goods), 1, fp);
fclose(fp);
printf( 是否继续,是(1),否(0) \n\t\t\t):
scanf (%d”, flag);
[while(flag!=0);
printf C\n
pnnnnnrtppnnnnnrippnnnnnrippnnnnnrippnnnnnrippnnn \n );
printf f 编号 名称单价 数量 总计
PAGE
PAGE #
,内
,内, PAGE #
\n);
for(y=l;y=g;y++)
(
printf (” %4d%10s%8. 2f%6d%13. 2f\n”, sc[y]. num, sc[
y]. name, sc[y]? price, a[y], m_y]);
zong=zong+mLy];
}
printfC 您此次一共消费%f元,欢迎您下次光临
\n”, zong);
shijianO ;
} zengjiaO//增加商品数量模块
(
float m;
int z=l;
int j[100],a[1001;
int g=0;
int y=0;
in
您可能关注的文档
最近下载
- QBT-制盐工业通用检测方法 微量溴的测定.pdf
- 初中化学新课标课程标准2022年版考试真题及答案A卷.pdf VIP
- 2026年福建生物工程职业技术学院单招职业技能考试题库带答案详解(培优).docx VIP
- 2026高考英语书面表达:应用文写作模板与技巧专题.docx VIP
- 毕业论文(设计)四自由度机械手结构设计及其PLC控制.doc VIP
- 2026年福建生物工程职业技术学院单招职业技能考试题库附答案详解(综合题).docx VIP
- 能源技术概论讲义.doc VIP
- OMRON欧姆龙健康血压计HEM-7522说明书用户手册.pdf
- 统计学原理(第三版)课件全套 苏继伟 第1--9章 总论、统计资料的收集 --- 抽样与抽样估计 .pptx
- 网络推广实务(微课版).pptx VIP
原创力文档

文档评论(0)