string[] name = { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };
int scores=0, avg;
for (int i = 0; i < score.Length; i++)
{
scores += score[i];
}
avg = scores / score.Length;
Console.Write("平均分是" + avg + ",高于平均分的有:\n");
for (int x = 0; x < name.Length; x++)
{
if(score[x]>avg)
{
Console.Write(name[x]);
Console.Write(" ");
}
}
你好,朋友!
你的问题是标点符号不对
在 ",高于平均分的有:\n"一句中英文引号内的逗号(,)和冒号(:)都是中文状态下,应该把它们改成英文状态下的逗号和冒号。