c商品订购系统Word文件下载.docx

上传人:b****1 文档编号:5045295 上传时间:2023-05-04 格式:DOCX 页数:8 大小:15.39KB
下载 相关 举报
c商品订购系统Word文件下载.docx_第1页
第1页 / 共8页
c商品订购系统Word文件下载.docx_第2页
第2页 / 共8页
c商品订购系统Word文件下载.docx_第3页
第3页 / 共8页
c商品订购系统Word文件下载.docx_第4页
第4页 / 共8页
c商品订购系统Word文件下载.docx_第5页
第5页 / 共8页
c商品订购系统Word文件下载.docx_第6页
第6页 / 共8页
c商品订购系统Word文件下载.docx_第7页
第7页 / 共8页
c商品订购系统Word文件下载.docx_第8页
第8页 / 共8页
亲,该文档总共8页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

c商品订购系统Word文件下载.docx

《c商品订购系统Word文件下载.docx》由会员分享,可在线阅读,更多相关《c商品订购系统Word文件下载.docx(8页珍藏版)》请在冰点文库上搜索。

c商品订购系统Word文件下载.docx

voidch5();

voidch6();

classgoods

{

public:

goods(void);

goods(string,string,float,string,float,string,float=0);

~goods(void);

voiddisplay1();

voiddisplay2();

stringgetnumber();

stringgetname();

floatgetprice();

floatgetstore();

stringgetunit2();

floatgetsold();

staticvoidtotalcount(float);

staticfloatgettotal();

voidplus_reduce(float);

private:

stringnumber;

stringname;

floatprice;

stringunit1;

floatstore;

stringunit2;

floatsold;

staticfloattotal;

};

intmain()etsold()>

0)isplay2();

}

}

cout<

<

"

总计:

goods:

:

gettotal()<

元"

endl;

etsold()!

=0)

{

etname()<

setw(15)<

good[i].getprice()<

good[i].getsold()<

setw(14)<

good[i].getprice()*good[i].getsold()<

file2<

合计:

商品浏览|"

line();

;

\t\t|2.商品购买|"

\t\t|3.查看帐单|"

\t\t|4.确认结帐|"

\t\t|5.退出程序|"

\t\t请选择菜单(1~6):

intch;

cin>

>

ch;

choose(ch);

}

voidch1()isplay1();

isplay1();

etnumber())etstore()>

1e-5)etunit2()=="

台"

&

fabs(m-float(int(m)))>

1e-5)

{

cout<

购买数量应为整数,请重新输入!

lus_reduce(m);

etprice()*good[i].getsold());

//计算商品价格

flag=1;

//改变flag值,表示已找到商品

}

if(!

flag)//若flag为0则未找到商品

cout<

找不到该商品,请重新输入!

gotoget;

back();

//返回购物菜单

voidch3()//显示购物清单

if(goods:

gettotal()>

0)

{

check();

else

cout<

您尚未购买任何商品,是否立即购买(Y/N):

charyn;

cin>

yn;

if(yn=='

y'

||yn=='

Y'

即将进入购物系统!

system("

pause"

);

//暂停

cls"

//清屏

ch2();

//进入购物系统

voidch4()//结算,支付函数

总计:

//输出总金额

floatn=0;

pay:

cout<

请输入支付金额:

//提示支付

floatm=0;

m;

n+=m;

gettotal()-n>

0)//若支付金额不足,则提示不足金额,要求重新支付

金额不足,还差"

gettotal()-n<

元,"

请继续支付!

gotopay;

if(n-goods:

=0)//金额足够则完成支付,并找零

找零"

n-goods:

支付完成,按任意键显示帐单!

system("

收款"

n<

找零"

谢谢惠顾,欢迎下次光临!

file_2();

//调用file_2,将清单存入

_exit();

//退出

}

即将进入购物系统!

voidch5()//退出系统

您是否确定退出本系统(Y/N):

charyn;

if(yn=='

back();

voidch6()//非菜单选项输入情况

输入错误,请重新输入!

//返回购物菜单

voidchoose(intch)//将菜单选择与各函数相连接实现功能选择

switch(ch)

case1:

ch1();

break;

case2:

ch2();

case3:

ch3();

case4:

ch4();

case5:

ch5();

default:

ch6();

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

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2