blob: c31c7b56cdd8d402cd2d6cdde2668abed3ea644d (
plain)
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
|
#include <vector>
#include <iostream>
#include "student_info.h"
#include "grade.h"
#include "approval.h"
bool fgrade(const StudentInfo& s) {
return grade(s) < 60;
}
std::list<StudentInfo>
extract_fails(
std::list<StudentInfo>& students)
{
std::list<StudentInfo> fail;
std::list<StudentInfo>::iterator iter = students.begin();
while (iter != students.end()) {
if (fgrade(*iter)) {
fail.push_back(*iter);
iter = students.erase(iter);
} else {
iter++;
}
}
return fail;
}
|