为了账号安全,请及时绑定邮箱和手机立即绑定

什么问题?

using System;

using System.Collections.Generic;

using System.Text;


namespace projAboveAvg

{

    class Program

    {

        static void Main(string[] args)

        {

        string[] name=new string[]{"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};

        int[] score=new int[]{90,65,88,70,46,81,100,68};

        int idax=0;

        for(int i=0;i<score.Lenght;i++)

        {

            idax+=score[i];

        }

        int gg=idax/score.Lenght;

        Console.Write[i]("平均分是"+gg+",高于平均分的有"+name);

        for(int i=0;i<score.Lenght;i++)

        {

            if(score[i]>gg)

            {

                Console.Write(name[i]+""/f");

            }

        }

        }

    }

}


正在回答

4 回答

 static void Main(string[] args)

        {

            string[] name = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };

            int[] score = new int[] { 90, 65, 88, 70, 46, 81, 100, 68 };

            int idax = 0;

            for (int i = 0; i < score.Length; i++)

            {

                idax += score[i];

            }

            int gg = idax / score.Length;

            Console.WriteLine("平均分是" + gg + ",高于平均分的有" + name);

            for (int i = 0; i < score.Length; i++)

            {

                if (score[i] > gg)

                {

                    Console.Write(name[i]+" ");

                }

            }

        }


0 回复 有任何疑惑可以回复我~

首先,所有的Length都拼错了。

其次,WriteLine.


0 回复 有任何疑惑可以回复我~

using System;
using System.Collections.Generic;
using System.Text;

namespace projAboveAvg
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] name = new string[] {"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};
            int[] score = new int[] { 90, 65, 88, 70, 46, 81, 100, 68 };
            int sum=0,avg=0,x=0;
            for (int i = 0; i < score.Length; i++)
            {
                sum += score[i];
            }
            avg = sum / score.Length;
            Console.Write("平均分是" + avg+","+"高于平均分的有:");
            Console.WriteLine();
            for (int i = 0; i < score.Length; i++)
            {
                if (score[i] > avg)
                {
                    x = i;
                    Console.Write("{0} ", name[i]);   
                }
              
            }
          
        }
    }
}

0 回复 有任何疑惑可以回复我~

Console.Write[i]("平均分是"+gg+",高于平均分的有"+name);

[i]多余了    Length  拼错了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

什么问题?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信