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

各位大神能帮忙看下报错原因吗?

using System;

using System.Collections.Generic;

using System.Text;


namespace Test

{

    class Program

    {

        static void Main(string[] args)

        {

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

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

            int x = 0;

            int w = 0;

            for (int i = 0; i < 9; i++)

            { if (cj[i] > x)

                { x = cj[i]; }

            }

            {

             w = x;

             Console.WriteLine("分数是"+ w);

            }

            for (int j = 0; j< 9; j++)

            { if (cj[j] == w)

                {

                    Console.WriteLine("分数最高的是" + name[j]);

                    break;

                 }

             }

        }

    }

}


正在回答

3 回答

我有点吐了,这个检测有点呆,我检查了半天,发现我的“,”没有和他的一样是中文的

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

这是我写的///




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

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

        }
    }
}


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

输出先后写反了,还有就是  for (int j = 0; j< 9; j++)  for (int i = 0; i < 9; i++)有错,应该是<8,或者用name.Length。

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

举报

0/150
提交
取消
C#开发轻松入门
  • 参与学习       251629    人
  • 解答问题       1448    个

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

进入课程

各位大神能帮忙看下报错原因吗?

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