クイズの結果です。n 人の点数が配列 scores に入っています(1 人以上)。いちばん高い点数を返す top_score(scores, n) を書きましょう。
top_score({72, 95, 88}, 3)→95top_score({60}, 1)→60int top_score(int scores[], int n)int top_score(int scores[], int n) {
int best = scores[0];
for (int i = 1; i < n; i++) {
// ここにコードを書く:best より大きければ、代わりにそれを残す
}
return best;
}
実行すると例で試せます。よさそうなら提出しましょう。