質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,3 +35,71 @@
|
|
35
35
|
}
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
```C++
|
40
|
+
|
41
|
+
#include <string>
|
42
|
+
|
43
|
+
#include <vector>
|
44
|
+
|
45
|
+
#include <algorithm>
|
46
|
+
|
47
|
+
#include <iostream>
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
struct score {
|
52
|
+
|
53
|
+
std::string name;
|
54
|
+
|
55
|
+
int aaa;
|
56
|
+
|
57
|
+
int bbb;
|
58
|
+
|
59
|
+
int ccc;
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
score(std::string n, int a, int b, int c) :
|
64
|
+
|
65
|
+
name(n), aaa(a), bbb(b), ccc(c) {}
|
66
|
+
|
67
|
+
};
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
class score_a {
|
74
|
+
|
75
|
+
public:
|
76
|
+
|
77
|
+
bool operator()(const score& value) const {
|
78
|
+
|
79
|
+
return value.aaa ;
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
};
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
int main() {
|
88
|
+
|
89
|
+
std::vector<score> v1;
|
90
|
+
|
91
|
+
v1.push_back(score("青木", 5, 10, 15));
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
int tokuten = std::count_if(v1.begin(), v1.end(), score_a());
|
96
|
+
|
97
|
+
std::cout << "青木:" << tokuten << std::endl;
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
return 0;
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
```
|