章数组与字符串.pptVIP

  • 1
  • 0
  • 约1.03万字
  • 约 43页
  • 2019-12-23 发布于湖北
  • 举报
* * * * * * * * 解析:这段程序的关键点在于遍历整个班级的成绩时,将第一名的成绩和最后一名的成绩保留下来。代码如下所示。 using System; public class ScoreSample { public int GetFirstScore(int[] list) { int firstScore = 0; foreach (int i in list) { if (i firstScore) firstScore = i; } return firstScore; } public int GetLastScore(int[] list) { int lastScore = int.MaxValue; foreach (int i in list) { if (i lastScore) lastScore = i; } return lastScore; } } class Tester { static void Main(s

文档评论(0)

1亿VIP精品文档

相关文档