qq_慕姐2428507
2020-11-04 15:25
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string[] name = {"吴松","钱东宇","伏晨","陈陆","周芯","林日鹏","何昆","关欣"};
int[] score = {89,90,98,56,60,91,93,85};
int temp = -1;
int num = 0;
for (int i = 0; i < score.Length; i++) {
temp = score[i] > temp ? score[i] : temp;
num = temp == score[i] ? i : num;
}
Console.Write("分数最高的是{0},分数是{1}",name[num],score[num]);
}
}
}
感兴趣可以康康,我没啥问题
C#开发轻松入门
254118 学习 · 1459 问题
相似问题