c++ primner plus 10.1

来源:互联网 发布:软件测试流生命周期 编辑:程序博客网 时间:2024/05/18 03:07

自己写的c++ primer plus 答案,求通过

#include<iostream>
using namespace std;
class account
{string name;
int money;
int num;
public:
account(string a,int x, int y)
{name=a;
money=x;
num=y;
}
void show()
{cout<<"user name is "<<name<<endl;
cout<<"he has :"<<money<<endl;
cout<<"his hum is"<<num<<endl;
}
~account()
{cout<<"bye"<<endl;
}
};
int main()
{int a,b;
string c;
cout<<"enter the date"<<endl;
cout<<"name"<<endl;
cin>>c;
cout<<"num"<<endl;
cin>>a;
cout<<"money"<<endl;
cin>>b;
account one(c,a,b);
int flag=0;
cout<<"push the date?"<<endl;
cin>>flag;
if(flag)
one.show();
return 0;
}

0 0