AchingImpact
2016-04-15 13:47
以下是代码:
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
class Program
{
static void Main(string[] args)
{
string[] N = new string[8] { "景珍","林慧洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int[] SCORE = new int[8] {90,65,88,70,46,81,100,68};
int sum=0,avg;
for (int i = 0; i < SCORE.Length; i++)
{
sum += SCORE[i];
}
avg = sum / SCORE.Length;
Console.Write("平均分是" + avg + ", ");
Console.WriteLine("高于平均分的有:");
for (int cb = 0; cb < SCORE.Length; cb++)
{
if (SCORE[cb] > avg)
Console.Write(N.[cb] + " ");
}
}
}
}
错误是这个:
最后一句打印多写了一个点,改成[code]Console.Write(N[cb] + " ");[/code]就好了。
C#开发轻松入门
254121 学习 · 1459 问题
相似问题