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

各位大佬看,这样写怎么样

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

    class Program

    {

        static void Main(string[] args)

        {

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

            string[] name = new string[] { "1", "2", "3", "4", "5", "6", "7", "8" };

            int x = 0;

            int max = num[0];

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

            {

                if (num[i] > max)

                {

                    max = num[i];

                    x++;

                }

            }

            Console.WriteLine("最好分姓名" + name[x] + "分数是" + max);

        }

    }

}


正在回答

1 回答

代码有问题,x++使用不对,不能用自加来确定x的位置。

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

举报

0/150
提交
取消

各位大佬看,这样写怎么样

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号