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

为什么提示运行成功,输出错误呢?

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

    class Program

    {

        static void Main(string[] args)

        {

             string[] name = { "吴松", "钱东宇", "伏晨", "陈陆", "周蕊", "林日鹏", "何昆", "关欣" };

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

            int max = 0;

            int m = 0;

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

            {

                if (score[i] > max)

                {

                    max = score[i];

                }

                else

                {

                    continue;

                }

                m = i;

            }

            Console.WriteLine("分数最高的是{0},分数是{1}", name[m], score[m]);

        }

    }

}


正在回答

2 回答

我用你的代码测试了许久,发现是  Console.WriteLine("分数最高的是{0},分数是{1}", name[m], score[m]);其中{0}后面的逗号是英文逗号,应该改成中文逗号。

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

姓名和分数不对,还有就是输出的逗号和冒号是中文格式

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

举报

0/150
提交
取消

为什么提示运行成功,输出错误呢?

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