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

来源:6-8 最终项目

qq_慕侠5280997

2020-05-15 00:33

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


写回答 关注

1回答

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

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

C#开发轻松入门

本门课程是C#语言的入门教程,将带你轻松入门.NET开发

254118 学习 · 1459 问题

查看课程

相似问题