Advertisement
Potap

Untitled

Dec 13th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. class human
  7. {
  8. public:
  9.     char name[50];
  10.     int age;
  11.     int number;
  12.     char gender;
  13.     virtual void methodprint()
  14.     {
  15.         cout << "\nName of human is " << name << endl << "The age of human is " << age << "\nThe doc number of human is " << number << endl << "\nThe gender of human is " << gender << endl;
  16.         cout << endl;
  17.     }
  18. };
  19.  
  20. class student:public human
  21. {
  22. public:
  23.     int course;
  24.     char universitet[50];
  25.     char facultet[50];
  26.     virtual void methodprint()
  27.     {
  28.         cout << "\nCourse of student is " << course << endl << "\nUniversitet of student is " << universitet << endl << "\nFacultet of student is " << facultet << endl;
  29.     }
  30. };
  31.  
  32. class papa :public human
  33. {
  34. public:
  35.     char wife;
  36.     int children;
  37.  
  38. };
  39.  
  40. int main()
  41. {
  42.     char name[50];
  43.     int age;
  44.     int number;
  45.     char gender;
  46.  
  47.     cout << "Enter name of human:";
  48.     cin >> name[50];
  49.     human(name)=name;
  50.  
  51.     cout << "Enter age:" << endl;
  52.     cin >> age;
  53.     human(age)=age;
  54.  
  55.     cout << "Enter number:" << endl;
  56.     cin >> number;
  57.     human(number)=number;
  58.  
  59.     cout << "Enter age:" << endl;
  60.     cin >> gender;
  61.     human(gender)=gender;
  62.  
  63.     system("pause");
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement