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

大神,帮忙看一下哪儿错了

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

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

正在回答

2 回答

你的index没有赋初始值

1 回复 有任何疑惑可以回复我~
#1

qq_万里晴空_1 提问者

大神,为什么index不赋初始值不可以啊
2017-02-21 回复 有任何疑惑可以回复我~
#2

qq_万里晴空_1 提问者

非常感谢!
2017-02-21 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

大神,帮忙看一下哪儿错了

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