求各位指点迷津啊!~:商店销售一产品,一次购十件打折9.8,价格由售货员自定,求该商店每件商品的均价
#include <iostream>using namespace std;
class product
{public:
product(int n,int q,int p ):num(n),quantity(q),price(p){};
int display();
private:
int num;
int quantity;
int price;
static int sum;
static int n;
};
int product:: display()
{
int cout=0,i=0,n=0;
for(i=0;i<3;i++)
{
cout<<"please input num,quantity and the price"<<endl;//错误'<<' : illegal, right operand has type 'char [40]'
cin>>nu[i].num>>endl>>nu[i].quantity>>endl>>nu[i].price>>endl;//错误'nu' : undeclared identifier。
if (quantity>10) price=0.98*price;
sum+=price;
n=n+quantity;}
cout<<(sum/n);//警告<<' : operator has no effect; expected operator with side-effect
return 0;
}
int product::sum=0;
int product::n=0;
int main()
{
int x,y;
product nu[3]={
product (01,1,15),
product (02,3,10),
product (03,20,20)};
int display();
return 0;
}