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

也可以这样吧

            string[,] names = new string[,] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "91" }, { "何昆", "93" }, { "关欣", "85" } };
            int max =0;
            string topName =null;
            for (int i = 0; i < 8; i++)
            {
                int score =Convert.ToInt32(names[i, 1]);
                string name = names[i, 0];
                if ( score > max)
                {
                    max = score;
                    topName = name;
                }
            }
            Console.Write("分数最高的是{0},分数是{1}",topName,max );

提问者:慕粉6383520 2018-12-24 17:40

个回答

  • qq_慕斯5468526
    2018-12-24 20:37:38

    String字符型,后面不能跟数字吧

  • qq_慕运维0487080
    2018-12-24 19:39:32

    数组元素,省劲,是个会偷懒的天才

  • qq_慕运维0487080
    2018-12-24 19:37:05

    可以啊