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

运行正确但是不符合要求。不知道哪不符合

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

                }
                
            }

提问者:懵石 2018-09-04 14:12

个回答

  • qq_是不是傻_1
    2018-09-06 09:50:57
    已采纳

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


  • 慕码人4209688
    2018-09-06 09:46:29

    你看一下:或是,之类的是否是用全角汉字打出来的,这个测试对这方面有限制