我的答案是这样的

来源:6-1 练习题目

CUZT

2018-04-03 18:08

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]);
        }
    }
}

写回答 关注

2回答

  • 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]);

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

C#开发轻松入门

本门课程是C#语言的入门教程,将带你轻松入门.NET开发

254118 学习 · 1459 问题

查看课程

相似问题