void show std vector student iterator if mn size for mn begin mn end s

 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
void show(){
std::vector <student> :: iterator i;
if (mn.size() > 0)
for (i = mn.begin(); i < mn.end(); i++)
std::cout<<*i;
else std::cout << "Group is empty!" << std::endl;
}
void SearchBySecondName(std::string secondName){
int k = 0;
std::cout << "Result for searching by second name:" << std::endl;
std::vector <student> :: iterator i;
for (i = mn.begin(); i < mn.end(); i++){
if ((*i).getSecondName() == secondName){
std::cout << *i << std::endl;
k = 1;
}
else k = 0;
}
if ( k == 0)
std::cout << "There is no such element!" << std::endl;
std::cout << std::endl;
}
int Size(){
return mn.size();
}
void SearchById(int id){
int k = 0;
std::cout << "Result for searching by number of record book:" << std::endl;
std::vector <student> :: iterator i;
for (i = mn.begin(); i < mn.end(); i++){
if ((*i).getIdStudent() == id){
std::cout << *i << std::endl;
k = 1;
}
else k = 0;
}
if ( k == 0 )
std::cout << "There is no such element!" << std::endl;
std::cout << std::endl;
}
Student_Group (const Student_Group &a){
int i = 0;
this->mn = a.mn;
std::cout << "Constructor copied!" << std::endl;
}
Student_Group & operator = (Student_Group &a){
mn = a.mn;
return *this;
}
void AddElement(){
student element;
std::cin >> element;
mn.push_back(element);
}
void DeleteElement(){
if (mn.size() > 1){
int in = 1;
std::vector <student> :: iterator i;
std::cout << "Choose id of student: " << std::endl;
for (i = mn.begin(); i < mn.end(); i++){
std::cout << "Id of student number " << in << ": " << (*i).getIdStudent() << std::endl;
in++;
}
int id;
std::cout << "Enter id of student" << std::endl;
std::cin >> id;
id = abs(id);
for (i = mn.begin(); i < mn.end();){
if ((*i).getIdStudent() == id)
i = mn.erase(i);
else
++i;
}
}
else mn.clear();
}