问答详情
源自:6-1 练习题目

我哪儿错了、、、

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

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

提问者:qq_慕圣9053515 2020-03-03 17:30

个回答

  • qq_慕斯8036334
    2020-03-04 21:45:55

     for(int i=0;i<grade.Lenght;i++):→Length

    Console.Write("分数最高的是{0},分数是{1}" ,y,x);:→建议这么写

     string y; :→定义完字符串要给他量→string y=name[0];