#include <iostream>
#include <string>
using namespace std;
class Dog{
public:
void setAttribute(string name,float age,string sex,float weight);
void showAttribute();
private:
string N;float A;string S;float W;
};
void Dog::setAttribute(string name,float age,string sex,float weight){
N=name;
A=age;
S=sex;
W=weight;
}
inline void Dog::showAttribute(){
cout<<"The dog is named as "<<N<<endl;
cout<<"The dog is "<<A<<" years old"<<endl;
cout<<"The dog is "<<S<<endl;
cout<<"The dog is "<<W<<" pounds"<<endl;
}
int main(){
Dog myDog;
string name,sex;
float age,weight;
cout<<"Please input the dog's attribute:"<<endl;
cin>>name>>age>>sex>>weight;
myDog.setAttribute(name,age,sex,weight);
myDog.showAttribute();
return 0;
}
#include <string>
using namespace std;
class Dog{
public:
void setAttribute(string name,float age,string sex,float weight);
void showAttribute();
private:
string N;float A;string S;float W;
};
void Dog::setAttribute(string name,float age,string sex,float weight){
N=name;
A=age;
S=sex;
W=weight;
}
inline void Dog::showAttribute(){
cout<<"The dog is named as "<<N<<endl;
cout<<"The dog is "<<A<<" years old"<<endl;
cout<<"The dog is "<<S<<endl;
cout<<"The dog is "<<W<<" pounds"<<endl;
}
int main(){
Dog myDog;
string name,sex;
float age,weight;
cout<<"Please input the dog's attribute:"<<endl;
cin>>name>>age>>sex>>weight;
myDog.setAttribute(name,age,sex,weight);
myDog.showAttribute();
return 0;
}