Visual Studio C++を使い、
名前、国語の点数、数学の点数、英語の点数 から国語の点数が60点以上を超える人数を数えるプログラムを作成しようとしているのですが、ここからどう書けばいいかわかりません。教えていただけないでしょうか、よろしくお願いします。
C++
1#include <string> 2#include <vector> 3#include <algorithm> 4#include <iostream> 5 6struct score { 7 std::string name; 8 int japanese; 9 int math; 10 int english; 11 12 score(std::string n, int j, int m, int e) : 13 name(n), japanese(j), math(m), english(e) {} 14}; 15 16 17class score_counter_ja { 18public: 19 20 bool operator()(const score& value) const { 21 22 } 23 24}; 25 26int main() { 27 std::vector<score> v; 28 v.push_back(score("浜田", 90, 81, 90)); 29 v.push_back(score("菊池", 48, 83, 69)); 30 v.push_back(score("松本", 79, 49, 39)); 31 32 33 int japanese = std::count_if(v.begin(), v.end(), score_counter_ja()); 34 35 std::cout << "国語:" << japanese << std::endl; 36 37 return 0; 38}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/23 09:38