kilolilo

account

Feb 27th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class human{
  5. public:
  6.     string name;
  7.     string surname;
  8.     int age;
  9.     human(string x,string y){
  10.         name=x;
  11.         surname=y;
  12.         age=0;
  13.     }
  14.     human(string x,string y,int age_1){
  15.         name=x;
  16.         surname=y;
  17.         age=age_1;
  18.     }
  19.     void say_hello(){
  20.         if(age>0){
  21.             cout<<"hello my name is "<<name<<"  "<<surname<<endl<<age<<" years old"<<endl;
  22.         }
  23.         else{
  24.           cout<<"hello my name is "<<name<<"  "<<surname<<endl;
  25.         }
  26.  
  27.     }
  28. };
  29.  
  30. int main()
  31. {
  32.     human b=human("Vasya","Pupkin",4356);
  33.     b.say_hello();
  34. }
Add Comment
Please, Sign In to add comment