C++编程题目,谢谢!

2024-12-03 04:31:41
推荐回答(1个)
回答1:

void CGoods::RegisterGoods(char n[],int a,float b)
{
strcpy(Name,n);
Amount=a;
Price=b;
Total-value=0;
}
void CGoods::CountTotal()
{
Total-value=Amount*Price;
}

CGoods::CGoods(char n[],int a,float b)
{
strcpy(Name,n);
Amount=a;
Price=b;
Total-value=0;
}

CGoods::CGoods(CGoods &p)
{
strcpy(Name,p.Name);
Amount=p.Amount;
Price=p.Price;
Total-value=p.Total-value;
}

int CGoods::GetAmount()
{
return Amount;
}

float CGoods::GetPrice()
{
return Price;
}

float CGoods::GetTotal()
{
return Total-value;
}