问答详情
源自:6-1 练习题目

用这些代码可以不?


            string[] names=new string[]{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何晶","关欣"};

            int[] scores=new int[]{89,90,98,56,60,91,93,85};

            int max=0;

            string name="";

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

            {

                if(max<scores[i])

                {

                    max=scores[i];

                    name=names[i];

                }

            }

            Console.Write("分数最高的是{0},分数是{1}",name,max);


提问者:William阿千 2019-05-24 10:50

个回答

  • 慕九州2710224
    2019-09-08 19:19:27

    static void Main(string[] args)        {            string[] arrName = {"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何晶","关欣"};            int[] arrScore = {89,90,98,56,60,91,93,85};            for(int x = 0;x<arrScore.Length;x++)            {                foreach(int y in arrScore)                {                    if(y<=arrScore[x])                    {                        Console.WriteLine("分数最高的是{0},分数是{1}",arrName[x],arrScore[x]);                    }else                        continue;                }            }        }


  • 小俏妞
    2019-07-19 16:05:19

    厉害,为什么我没头绪呢?

  • 慕妹0289491
    2019-05-24 11:05:00

    正确的