希望能更优化下
string[,] scores = new string[8,2]{{"景珍","90"},{"林惠洋","65"},{"成蓉","88"},{"洪南昌","70"},{"龙玉民","46"},{"单江开","81"},{"田武山","100"},{"王三明","68"}};
int avg=0;//平均分
for(int i=0;i<scores.GetLongLength(0);i++){
avg+=Convert.ToInt32(scores[i,1]);
}
avg = avg/8;
string name ="";//高于平均分的名字
for(int i=0;i<scores.GetLongLength(0);i++){
if(Convert.ToInt32(scores[i,1])>=avg){
name+=scores[i,0]+" ";
}
}
name = name.Trim(' ');
Console.WriteLine("平均分是{0},高于平均分的有:",avg);
Console.WriteLine(name);