问答详情
源自:6-8 最终项目

运行结果符合要求,但是提示输出错误,那位大侠给诊断一下

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]);
            }       
        }
    }
}


提问者:qq_慕侠5280997 2020-05-15 00:33

个回答

  • weixin_慕婉清2559913
    2020-05-20 11:31:28

    平均分是{0},高于平均分的有:          要用中文逗号?