求助啊!我想知道問題出在哪兒了,運行沒問題,就是不對!
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"}};
? ? ? ? ? ? int sum = 0;
? ? ? ? ? ? double avg = 0;
? ? ? ? ? ??
? ? ? ? ? ? for (int i = 0; i < name_Score.GetLongLength(0); i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? sum += int.Parse(name_Score[i, 1]);
? ? ? ? ? ? }
? ? ? ? ? ? avg = sum / name_Score.GetLongLength(0);
? ? ? ? ? ? Console.WriteLine("平均分是{0},高于平均分的有:", avg);
? ? ? ? ? ??
? ? ? ? ? ? for (int j = 0; j < name_Score.GetLongLength(0); j++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (int.Parse(name_Score[j, 1]) > avg)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(name_Score[j, 0] + " ");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2020-09-18
Console.WriteLine("平均分是{0},高于平均分的有:", avg);
這句里的冒號修改成: