static void Main(string[] args)
{
string [] names ={"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int [] score ={89,90,98,56,60,91,93,85};
int maxpeople = 0;
int maxscore = 0;
for(int i = 0 ;i<score.Length;i++){
if (score[i]>maxscore){
maxscore = score[i];
maxpeople = i;
}
}
Console.Write("分数最高的是"+names[maxpeople]+",分数是"+score[maxpeople]);
}
并不能 强类型语言 数组内类型必须一致
string[,] test = new string[8, 2] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈璐", "56" }, { "周蕊", "60" }, { "林日鹏", "91" }, { "何坤", "93" }, { "关欣", "85" } };
int a = 0 , ii = 0;
string b = "";
for (int i = 0; i < test.GetLongLength(0); i++)
{
if (Convert.ToInt32(test[i, 1]) > a)
{
//Console.WriteLine(test[i, 1]);
a = Convert.ToInt32(test[i, 1]);
b = test[i, 0];
ii = i;
}
}
Console.WriteLine(a);
Console.WriteLine(b);
Console.WriteLine(ii);