编一个c++的程序

来源:百度知道 编辑:UC知道 时间:2024/05/12 03:26:53
一个人去买了三种物品,用程序代码分别输出数量,单价,总价.要用类定义
谢谢啊!!!!!!
鄙人才疏学浅!!1帮帮忙啊

class goods
{
name = ;
amount = ;
unit_price = ;
total_price = ;
goods(name,amount,unit_price)
{
name = this.name;
amount = this.amount;
unit_price = this.unit_price;
total_price = amount * unit_price;
}

getXX(){}
}

大约就是这么个形式,至于具体的数据类型及代码格式自己写吧,呵呵