string [,]nScore=new string[,]
{
{"景珍","90"},{"林惠洋","65"},
{"成蓉","88"},{"洪南昌","70"},
{"龙玉民","46"},{"单江开","81"},
{"田武山","100"},{"王三明","68"}
};
int sum = 0;
int avg = 0;
string name = nScore[0, 0];
int i = 0;
string[] tName = new string[] { };
for (i = 0; i < Convert.ToInt32(nScore.GetLength(0)); i++)
{
sum = sum + Convert.ToInt32(nScore[i, 1]);
}
avg = sum / Convert.ToInt32(nScore.GetLength(0));
Console.WriteLine("平均分是{0},高于平均分的有:", avg);
for (i = 0; i < Convert.ToInt32(nScore.GetLength(0)); i++)
{
if (Convert.ToInt32(nScore[i, 1]) > avg)
{
name = nScore[i, 0];
Console.Write(name+" ");
}
}
"平均分是{0},高于平均分的有:", avg);
双引号中的逗号和冒号改成中文的就能通过了Console.WriteLine("平均分是{0},高于平均分的有:", avg);