C++课程设计商品销售统计Word格式.docx

上传人:b****6 文档编号:17439139 上传时间:2022-12-01 格式:DOCX 页数:24 大小:626.17KB
下载 相关 举报
C++课程设计商品销售统计Word格式.docx_第1页
第1页 / 共24页
C++课程设计商品销售统计Word格式.docx_第2页
第2页 / 共24页
C++课程设计商品销售统计Word格式.docx_第3页
第3页 / 共24页
C++课程设计商品销售统计Word格式.docx_第4页
第4页 / 共24页
C++课程设计商品销售统计Word格式.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

C++课程设计商品销售统计Word格式.docx

《C++课程设计商品销售统计Word格式.docx》由会员分享,可在线阅读,更多相关《C++课程设计商品销售统计Word格式.docx(24页珍藏版)》请在冰豆网上搜索。

C++课程设计商品销售统计Word格式.docx

string>

fstream>

usingnamespacestd;

intchoice;

classGOODS

{

private:

stringname;

//商品名

stringunit;

//计量单位

doubleprice_per_unit;

//单价

doubleamount;

//商品总数

public:

GOODS();

//构造函数

//排序函数,使得信息为空的商品类数组元素沉底,不为空的排在前面(被"

删除商品信息函数"

调用)

friendvoidsort(GOODSarray[],intsize);

friendvoidinput_gds_mesg(GOODSgoods1[],intsize);

//底层函数:

录入商品信息(从属于商品信息管理系统)

friendvoidMessage_modify(GOODSgoods2[],intsize);

修改商品信息(从属于商品信息管理系统)

friendvoidMessage_delete(GOODSgoods3[],intsize);

删除商品信息(从属于商品信息管理系统)

friendvoidGoods_Message_Manage(GOODSGoods1[],intsize);

//中层函数:

1.商品信息管理系统(从属于商品销售统计工程)

friendvoidGoods_Sale(GOODSGoods2[],intsize);

2.商品销售系统(从属于商品销售统计工程)

friendvoidWORK(GOODSGoods[],intsize);

//高层函数:

商品销售统计工程

};

GOODS:

:

GOODS()

name="

0"

;

unit="

price_per_unit=0.0;

amount=0;

}

voidinput_gds_mesg(GOODSgoods1[],intsize)//底层函数:

录入商品信息函数(从属于商品信息管理系统)

{

inti,j,m=0;

ints=size;

intn=size;

stringl;

for(i=0;

i<

s;

i++)

{

if(goods1[i].name!

="

)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)//底层函数:

修改商品信息函数(从属于商品信息管理系统)

if(goods2[0].name=="

Caution:

当前无商品信息,请返回更新!

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;

{

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<

请输入您想修改信息的商品编号:

//intn;

__您想修改信息的商品为:

n<

goods2[n-1].name<

//stringp;

p;

if(p=="

||p=="

{cout<

do

{

cout<

1.修改商品名称"

cout<

2.修改商品计量单位"

3.修改商品单价(元)"

4.修改商品数量"

请输入您的选择(1-4):

cin>

choice2;

switch(choice2)

{

case1:

请输入"

号商品"

的名称:

//!

!

name;

goods2[n-1].name=name;

break;

case2:

的计量单位:

cin>

unit;

goods2[n-1].unit=unit;

break;

case3:

cout<

的单价:

price;

goods2[n-1].price_per_unit=price;

case4:

的数量:

intnum;

amount;

goods2[n-1].amount=amount;

default:

对不起,输入有误,请从新输入!

}

}while(choice2!

=1&

&

choice2!

=2&

=3&

=4);

}while(p=="

);

__继续修改商品信息(y/n)?

//stringq;

q;

}while(q=="

||q=="

__商品信息修改完成!

"

voidsort(GOODSarray[],intsize)//排序函数,使得信息为空的商品类数组元素沉底,不为空的排在前面(被"

inti,j;

GOODStemp;

size-1;

for(j=0;

size-1-i;

if(array[j].name=="

array[j+1].name!

temp=array[j];

array[j]=array[j+1];

array[j+1]=temp;

voidMessage_delete(GOODSgoods3[],intsize)//底层函数:

删除商品信息函数(从属于商品信息管理系统)

if(goods3[0].name=="

对不起,当前无商品信息,请返回更新!

Goods_Message_Manage(goods3,size);

WORK(goods3,size);

//doubleprice;

if(goods3[i].name!

elseif(goods3[i].name=="

goods3[i].name<

goods3[i].price_per_unit<

goods3[i].unit<

goods3[i].amount<

请输入您想删除信息的商品编号:

__您想删除信息的商品为:

goods3[n-1].name<

goods3[n-1].name="

goods3[n-1].unit="

goods3[n-1].price_per_unit=0.0;

goods3[n-1].amount=0;

__继续删除商品信息(y/n)?

__商品信息删除完成!

sort(goods3,size);

voidGoods_Message_Manage(GOODSGoods1[],intsize)//中层函数:

M.商品信息管理系统(从属于商品销售统计工程)

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)//中层函数:

S.商品销售系统(从属于商品销售统计工程)

if(Goods2[0].name=="

Goods_Message_Manage(Goods2,size);

WORK(Goods2,size);

intnum[1000],amount[1000];

//num[]存放所要购买商品的编号,amount[]存放购买的每种商品数量

intj=0,f=0,r=0;

doublemoney=0.0;

end

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 考试认证 > 交规考试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1