结果为什么不是输入的数了
#include"math.h"#include"iostream"
using namespace std;
class data
{
protected:
int m;
double n,p;
public:
data(){}
data(int a,double b)
{
m=a;
n=b;
}
void buy()
{
cout<<n<<endl;
cout<<m<<endl;
}
};
int main()
{
double x,s1;
int y;
cout<<"价格:";
cin>>x;
cout<<"数量:";
cin>>y;
data z(y,x);
data w;
w.buy();
return 0;
}