{
string[] name=new string[]{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昂","吴欣"};
int[] score=new int[]{29,90,98,56,60,91,93,85};
int max=score[0];
char maxname=name[0];
for(int i;i<score.Length;i++)
{
if(max<score[i])
max=scoe[i];
maxname=name[i];
}
Console.WriteLine("分数最高的是"+maxname+",分数是"+max);
}
string[] name = new string[] { "吴松", "钱东宇", "伏晨", "陈陆", "周蕊", "林日鹏", "何昂", "吴欣" };
int[] score = new int[] { 29, 90, 98, 56, 60, 91, 93, 85 };
int max = score[0];
string maxname = name[0]; //这里的maxname 声明 应该用 string
for (int i=0; i < score.Length; i++) //这里int i 还没赋值。赋值为0.
{
if (max < score[i])
{ // 这里应该用花括号
max = score[i]; //这里score少写了“r”
maxname = name[i];
}
}
Console.WriteLine("分数最高的是" + maxname + ",分数是" + max);
}
char maxname=name[0]; 类型string maxname
max=scoe[i];后面是score
int i没有初始值
啊哈,感觉没毛病吖老铁
buzhidao