谁知道哪里错了?

来源:6-1 练习题目

weixin_慕数据4058855

2020-04-16 15:33

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

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


写回答 关注

1回答

  • weixin_慕数据4058855
    2020-04-16 18:10:12

    已解决

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

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


C#开发轻松入门

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

254118 学习 · 1459 问题

查看课程

相似问题