为了账号安全,请及时绑定邮箱和手机立即绑定

运行成功 输出错误

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

正在回答

3 回答

运行结果意思是对的,结果有误是你的标点格式与答案不一样,你换成中文逗号就可以了

0 回复 有任何疑惑可以回复我~

是对的,没问题

0 回复 有任何疑惑可以回复我~

string[,] test = new string[8, 2] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "91" }, { "何昆", "93" }, { "关欣", "85" } };
        int max = 0, m = 0;
        for (int i = 0; i < test.GetLongLength(0); i++)
        {
            int n = Convert.ToInt16(test[i, 1]);
            if (n >= max)
            {
                max = n;
                m = i;
            }
        }
        Console.WriteLine("分数最高的是{0},分数是{1}。", test[m, 0], test[m, 1]);

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

运行成功 输出错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信