SHARE
TWEET

Untitled

a guest Dec 8th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ConsoleApplication40.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
  2. //
  3.  
  4. #include <iostream>
  5. #include<string>
  6. using namespace std;
  7. class Group
  8. {
  9. private:
  10.   string name;
  11.   int numberOfPersons;
  12.   string leaderSurname;
  13. public:
  14.   Group()
  15.   {
  16.     name = leaderSurname = "";
  17.     numberOfPersons = 0;
  18.   }
  19.   Group(string name, int numberOfPersons, string leaderSurname)
  20.   {
  21.     this->name = name;
  22.     this->numberOfPersons = numberOfPersons;
  23.     this->leaderSurname = leaderSurname;
  24.   }
  25.   void Show()
  26.   {
  27.     cout << name << " " << numberOfPersons << " " << leaderSurname << endl;
  28.   }
  29. };
  30. class Faculty
  31. {
  32. private:
  33.   string name;
  34.   int numberOfGroups;
  35.   static const int maxSize = 10;
  36.   Group groups[maxSize];
  37. public:
  38.   Faculty()
  39.   {
  40.     name  = "";
  41.     numberOfGroups =0;
  42.   }
  43.   Faculty(string name, int numberOfGroups, Group groups[])
  44.   {
  45.     this->name = name;
  46.     this->numberOfGroups = numberOfGroups;
  47.     for (int i = 0; i < numberOfGroups; i++)
  48.     {
  49.       this->groups[i] = groups[i];
  50.     }
  51.   }
  52.   void Show()
  53.   {
  54.     cout << name << " " << numberOfGroups << endl;
  55.     for (int i = 0; i < numberOfGroups; i++)
  56.     {
  57.       this->groups[i].Show();
  58.     }
  59.   }
  60.  
  61. };
  62. int main()
  63. {
  64.   Group groups[3] = { Group("T-1",19,"Ivanov"),Group("T-2",18,"Petrov") ,Group("T-3",28,"Soloviev") };
  65.   Faculty faculty("Math", 3, groups);
  66.   faculty.Show();
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top