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

逗号都改中文了,还报错?大神求解

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

    class Program

    {

        static void Main(string[] args)

        {

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

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

            int high=0;

            string s;

            foreach(int i in score){

                if(score[i]>high){

                    high=score[i];

                    s=names[i];

                }

            }

            Console.WriteLine ("分数最高的是{0},分数是{1}",s,high);

            

        }

    }

}


正在回答

1 回答

string s;这个声明时必须赋值,我改为string s=names[0];时就运行出来了

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

举报

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

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

进入课程

逗号都改中文了,还报错?大神求解

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