#include
#include
using namespace std;
class Invoice
{
public:
explicit Invoice(int amount)
{
amount=p*q;
}
string partnumber(string number)
{
return number ;
}
string partdescription(string description)
{
return description;
}
void perchased(int quantity)
{
q=quantity;
}
void priceperitem(int price)
{ 尘模
p=price;
}
int getInvoiceAmount()
{
if (q<0)
q=0;
if (p<0)
p=0;
cout<<"the amount is:"<
return amount1;
}
private:
int q;
int p;
int amount1;
};
int main()
{
int q;
int p;
string number; //注意参数类型
string description;//注意参数类型
Invoice aa(1);//需要定义Invoice的一个对象aa
cout<<"please enter the part number,the part description,the quantity of the items and the price per item:"<cin>>number>>description>>q>>派握缓p; 皮姿//改成description
cout<<"your part number is:"<cout<<"your part description is:"< aa.getInvoiceAmount();
}
注释已经写了,感觉对象和类傻傻分不清楚的样子啊!
cout<<"your part number is:"<
main函数
>>Invoice.XXXXX
<滚蠢埋
main()
{
Invoice invObj;
>>invObj.XXXXX
}