Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication40.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
- //
- #include <iostream>
- #include<string>
- using namespace std;
- class Group
- {
- private:
- string name;
- int numberOfPersons;
- string leaderSurname;
- public:
- Group()
- {
- name = leaderSurname = "";
- numberOfPersons = 0;
- }
- Group(string name, int numberOfPersons, string leaderSurname)
- {
- this->name = name;
- this->numberOfPersons = numberOfPersons;
- this->leaderSurname = leaderSurname;
- }
- void Show()
- {
- cout << name << " " << numberOfPersons << " " << leaderSurname << endl;
- }
- };
- class Faculty
- {
- private:
- string name;
- int numberOfGroups;
- static const int maxSize = 10;
- Group groups[maxSize];
- public:
- Faculty()
- {
- name = "";
- numberOfGroups =0;
- }
- Faculty(string name, int numberOfGroups, Group groups[])
- {
- this->name = name;
- this->numberOfGroups = numberOfGroups;
- for (int i = 0; i < numberOfGroups; i++)
- {
- this->groups[i] = groups[i];
- }
- }
- void Show()
- {
- cout << name << " " << numberOfGroups << endl;
- for (int i = 0; i < numberOfGroups; i++)
- {
- this->groups[i].Show();
- }
- }
- };
- int main()
- {
- Group groups[3] = { Group("T-1",19,"Ivanov"),Group("T-2",18,"Petrov") ,Group("T-3",28,"Soloviev") };
- Faculty faculty("Math", 3, groups);
- faculty.Show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement