-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstudents.cpp
More file actions
43 lines (39 loc) · 889 Bytes
/
students.cpp
File metadata and controls
43 lines (39 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "students.h"
#include <cstdlib>
#include <string>
Student::Student(std::string name)
{
this->name = name;
memes_siense = RandomGrade();
dota_siense = RandomGrade();
base_of_mid_laning = RandomGrade();
history_of_anchient_patches = RandomGrade();
laning_and_base_of_warding = RandomGrade();
arrGrade[0] = &memes_siense;
arrGrade[1] = &dota_siense;
arrGrade[2] = &base_of_mid_laning;
arrGrade[3] = &history_of_anchient_patches;
arrGrade[4] = &laning_and_base_of_warding;
}
int Student::GetMinGrade()
{
int min = 5;
for (auto& grade : arrGrade)
{
if (min > *grade)
min = *grade;
}
return min;
}
int Student::RandomGrade()
{
int tmp = rand() % 10;
if (tmp < 1)
return 2;
else if (tmp < 4)
return 3;
else if (tmp < 8)
return 4;
else
return 5;
}