C++课程设计商品销售统计Word格式文档下载.docx
《C++课程设计商品销售统计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《C++课程设计商品销售统计Word格式文档下载.docx(19页珍藏版)》请在冰豆网上搜索。
#include<
iostream>
string>
fstream>
usingnamespacestd;
intchoice;
classGOODS
{
private:
stringname;
品信息管理系统(从属于商品销售统计工程)
friendvoidGoods_Sale(GOODSGoods2[],intsize);
品销售系统(从属于商品销售统计工程)
friendvoidWORK(GOODSGoods[],intsize);
ame!
="
0"
)m++;
elseif(goods1[i].name=="
)s=m;
}
for(j=m;
j<
n;
j++)
{
cout<
<
"
________________________________________________________________________"
endl;
>
请输入第"
j+1<
种商品的名称:
__"
;
cin>
goods1[j].name;
cout<
种商品的计量单位:
goods1[j].unit;
种商品的单价(元):
goods1[j].price_per_unit;
种商品的数量:
goods1[j].amount;
__继续录入商品信息(y/n)__"
cin>
l;
if(l=="
n"
||l=="
N"
)n=j;
elseif(l=="
y"
Y"
){};
__商品信息录入完成!
endl<
return;
}
voidMessage_modify(GOODSgoods2[],intsize)ame=="
)
Caution:
当前无商品信息,请返回更新!
(y/n)__"
stringc;
c;
if(c=="
||c=="
{
Goods_Message_Manage(goods2,size);
WORK(goods2,size);
}
else
cout<
谢谢使用,祝您愉快!
再见!
exit(0);
stringp,q;
intn;
stringunit;
stringname;
doubleprice;
doubleamount;
intchoice2;
do
do
---------------------------商品信息列表--------------------------"
\t商品编号\t商品名称\t商品单价\t商品余量"
inti,m=0;
ints=size;
for(i=0;
i<
s;
i++)
{
if(goods2[i].name!
elseif(goods2[i].name=="
}
m;
\t"
i+1<
."
goods2[i].name<
goods2[i].price_per_unit<
元"
/"
goods2[i].unit<
goods2[i].amount<
请输入您想修改信息的商品编号:
goods2[n-1].name<
改商品名称"
cout<
2.修改商品计量单位"
3.修改商品单价(元)"
4.修改商品数量"
cout<
请输入您的选择(1-4):
cin>
choice2;
switch(choice2)
{
case1:
请输入"
n<
号商品"
的名称:
ame=name;
break;
case2:
的计量单位:
nit=unit;
break;
case3:
cout<
的单价:
rice_per_unit=price;
case4:
的数量:
mount=amount;
default:
对不起,输入有误,请从新输入!
}
}while(choice2!
=1&
&
choice2!
=2&
=3&
=4);
}while(p=="
||p=="
);
__继续修改商品信息(y/n)__"
ame=="
array[j+1].name!
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
voidMessage_delete(GOODSgoods3[],intsize)ame=="
对不起,当前无商品信息,请返回更新!
Goods_Message_Manage(goods3,size);
WORK(goods3,size);
elseif(goods3[i].name=="
goods3[i].name<
goods3[i].price_per_unit<
goods3[i].unit<
goods3[i].amount<
请输入您想删除信息的商品编号:
goods3[n-1].name<
ame="
goods3[n-1].unit="
goods3[n-1].price_per_unit=;
goods3[n-1].amount=0;
__继续删除商品信息(y/n)__"
品信息管理系统(从属于商品销售统计工程)
intchoice1;
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★"
★★"
★商品信息管理系统★"
>
请选择您要执行的操作<
"
1.录入新商品信息"
2.修改商品信息"
3.删除商品信息"
4.返回"
0.退出"
_____________________________________________________________"
请输入您的选择:
(0-4)__"
choice1;
switch(choice1)
case1:
input_gds_mesg(Goods1,size);
break;
case2:
Message_modify(Goods1,size);
case3:
Message_delete(Goods1,size);
case4:
WORK(Goods1,size);
case0:
default:
对不起,您的输入有误,请重新进行选择!
break;
}while(choice1!
=0&
choice1!
voidGoods_Sale(GOODSGoods2[],intsize)品销售系统(从属于商品销售统计工程)
if(Goods2[0].name=="
Goods_Message_Manage(Goods2,size);
WORK(Goods2,size);
intnum[1000],amount[1000];
elseif(Goods2[i].name=="
for(i=0;
Goods2[i].name<
Goods2[i].price_per_unit<
Goods2[i].unit<
Goods2[i].amount<
请输入您想购买的商品的编号(输入“0”结束):
ame<
}
__确认(y/n)__"
cin>
amount[r];
Goods2[num[f]-1].amount-=amount[r];
__您购买的商品信息如下:
\t商品编号\t商品名称\t商品单价\t购买数量"
for(f=0,r=0;
(f<
j-1)&
(r<
size);
f++,r++)
{
if(num[f]!
=0)
num[f]<
Goods2[num[f]-1].name<
Goods2[num[f]-1].price_per_unit<
Goods2[num[f]-1].unit<
amount[r]<
money+=Goods2[num[f]-1].price_per_unit*amount[r];
__您一共应支付"
money<
元."
__继续购物(y/n)__"
品信息管理系统"
2.商品销售系统"
请输入您的选择:
(0-2)__"
choice;
switch(choice)
Goods_Message_Manage(Goods,size);
Goods_Sale(Goods,size);
break;
default:
您的输入有误,请重新输入!
}while(choice!
=0);
intmain()
{
GOODSgoods[1000];
★☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆★"
★☆☆★"
★☆商品销售应用系统☆★"
->
->
WELCOME<
-<
-"
WORK(goods,1000);
return0;
7.程序实现