qq_慕圣9053515
2020-03-03 17:30
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
int [] grade = new int []{89,90,98,56,60,91,93,85};
string [] name = new string []{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int x=0;
string y;
for(int i=0;i<grade.Lenght;i++){
if(grade[i]>=x){
y=name[i];
x=grade[i];
}
}
Console.Write("分数最高的是"+y+",分数是"+x);
}
}
}
for(int i=0;i<grade.Lenght;i++):→Length
Console.Write("分数最高的是{0},分数是{1}" ,y,x);:→建议这么写
string y; :→定义完字符串要给他量→string y=name[0];
C#开发轻松入门
254118 学习 · 1459 问题
相似问题