这个里面哪里错了,if (score[i] > avg)提示超出数组限界?
string[] name = new string[8];
int[] score = new int[8];
for (int i = 0; i < name.Length; i++)
{
Console.Write("输入姓名:");
name[i] = Console.ReadLine();
Console.Write("输入分数:");
score[i] = int.Parse(Console.ReadLine());
}
int sum = 0, avg;
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
avg = sum / score.Length;
Console.WriteLine("平均分是"+avg+",高于平均分的有");
for (int i = 0; 0 < score.Length; i++)
if (score[i] > avg)
Console.Write(name[i]+" ");