edit exercise 1
This commit is contained in:
parent
c3e27642b2
commit
6c7f00e7f7
|
@ -74,6 +74,13 @@ public:
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Student(const Student &s) : Person(s)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
|
||||||
|
m_yos = s.m_yos;
|
||||||
|
}
|
||||||
|
|
||||||
static void printCount()
|
static void printCount()
|
||||||
{
|
{
|
||||||
std::cout << "Количество студентов: " << count << std::endl;
|
std::cout << "Количество студентов: " << count << std::endl;
|
||||||
|
|
|
@ -9,17 +9,16 @@ int Student::count = 0;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Student students[] =
|
vector<Student> students;
|
||||||
{
|
|
||||||
Student("Олег", 20, GENDER_MALE, 75.2, 2020),
|
|
||||||
Student("Андрей", 19, GENDER_MALE, 72.8, 2020),
|
|
||||||
Student("Анастасия", 20, GENDER_FEMALE, 55.2, 2020),
|
|
||||||
Student("Ольга", 21, GENDER_FEMALE, 49.3, 2020),
|
|
||||||
Student("Владимир", 19, GENDER_MALE, 69.9, 2020)
|
|
||||||
};
|
|
||||||
|
|
||||||
students[0].printInfo();
|
students.emplace_back("Олег", 20, GENDER_MALE, 75.2, 2020);
|
||||||
students[2].printInfo();
|
students.emplace_back("Андрей", 19, GENDER_MALE, 72.8, 2020);
|
||||||
|
|
||||||
|
Student::printCount();
|
||||||
|
|
||||||
|
students.emplace_back("Анастасия", 20, GENDER_FEMALE, 55.2, 2020);
|
||||||
|
students.emplace_back("Ольга", 21, GENDER_FEMALE, 49.3, 2020);
|
||||||
|
students.emplace_back("Владимир", 19, GENDER_MALE, 69.9, 2020);
|
||||||
|
|
||||||
Student::printCount();
|
Student::printCount();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue