void DeleteElement if mn size int in std vector student iterator std c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();
}