運(yùn)行結(jié)果符合要求,但是提示輸出錯(cuò)誤,那位大俠給診斷一下
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
???????? string[,] name_score = new string[,] { { "景珍", "90" }, { "林惠洋", "65" }, { "成蓉", "88" }, { "洪南昌", "70" }, { "龍玉民", "46" }, { "單江開", "81" }, { "田武山", "100" }, { "王三明", "68" } };
??????????? double sum = 0, avg;
??????????? for (int i = 0; i<name_score.GetLength(0); ++i)
??????????? {
??????????????? sum += double.Parse(name_score[i, 1]);
??????????? }
??????????? avg = sum / name_score.GetLength(0);
??????????? Console.WriteLine("平均分是{0},高于平均分的有:", avg);
??????????? for (int i = 0; i< name_score.GetLength(0); i++)
??????????? {
??????????????? if (avg < double.Parse(name_score[i, 1]))
??????????????????? Console.Write("{0} ",name_score[i, 0]);
??????????? }???????
??????? }
??? }
}
2020-05-20
平均分是{0},高于平均分的有:? ? ? ? ? 要用中文逗號(hào)?