错在哪里了

 string[] name = {"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
            int[] score= {90,65,88,70,46,81,100,68};
            int temp = score[0];
            for (int i = 0;i < 8;i++)
              {
                  int sum = sum + score[i];
              }
               int avg = sum/8;
               for (int i = 0;i < 8;i++)
            {
              if(score[i] > avg)
                 {
                     string name1 = name1 + " " + name[i];
                 }
            }
            {
            Console.WriteLine("平均分是{0},高于平均分的有{1}",avg,name1);
            }   

我的学习啊
浏览 794回答 1
1回答

冰封一切1

恕我菜鸟比较笨,我想先问下int sum = sum + score[i];,这种格式对吗?而且还是在for循环里定义的,定义完没初始化就直接拿去用,而且需要每次循环定义一次num嘛?还有for里面定义的可以在for循环的外面使用嘛???,下面name也类似
打开App,查看更多内容
随时随地看视频慕课网APP