遍历一次成绩数组,维护一个变量 maxScore 来记录目前遇到的最大值,初始化为数组的第一个元素或极小值。每读到一个成绩,就用它与 maxScore 比较并更新。遍历结束后,maxScore 即为数组最大元素。
maxScore
小乐乐的老师BoBoBoBoBoBo想知道班级中谁的数学成绩最高,请编程帮他实现。
本题属于以下题库,请选择所需题库进行购买
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your CodeFun2000 universal account