Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class human{
- public:
- string name;
- string surname;
- int age;
- human(string x,string y){
- name=x;
- surname=y;
- age=0;
- }
- human(string x,string y,int age_1){
- name=x;
- surname=y;
- age=age_1;
- }
- void say_hello(){
- if(age>0){
- cout<<"hello my name is "<<name<<" "<<surname<<endl<<age<<" years old"<<endl;
- }
- else{
- cout<<"hello my name is "<<name<<" "<<surname<<endl;
- }
- }
- };
- int main()
- {
- human b=human("Vasya","Pupkin",4356);
- b.say_hello();
- }
Add Comment
Please, Sign In to add comment