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

我的答案是这样的

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

namespace projGetMaxScore
{
    class Program
    {
        static void Main(string[] args)
        {
            string[,] info = new string[8, 2] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "91" }, { "何昆", "93" }, { "关欣", "85" } };
            /*int y=int.Parse(info[2,1]);
            Console.WriteLine(y);*/
            int x=0;
            for(int i=0;i<8;i++)
            {
                if(int.Parse(info[i,1])>int.Parse(info[x,1]))
                {
                    x=i;
                }
                else
                {
                    x=x+0;
                }
            }
            Console.WriteLine("分数最高的是"+info[x,0]+",分数是"+info[x,1]);
        }
    }
}

提问者:CUZT 2018-04-03 18:08

个回答

  • braycep
    2018-05-18 19:24:08

    using System;

    using System.Collections.Generic;

    using System.Text;


    namespace projGetMaxScore

    {

        class Program

        {

            static void Main(string[] args)

            {

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

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

                

                int maxI = 0;

                int maxS = 0;

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

                    if(scores[i] > maxS){

                        maxS = scores[i];

                        maxI = i;

                    }

                }

                

                Console.WriteLine("分数最高的是{0},分数是{1}",names[maxI],maxS);

            }

        }

    }



  • 小CP
    2018-04-04 18:27:18

    Console.WriteLine("分数最高的是"+info[x,0]+",分数是"+info[x,1]);

    “,分数是”逗号应为中文逗号