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

这样可行吗

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

    class Program

    {

        public class Student

        {

            public string name { get; set; }

            public int score { get; set; }

      

        }

        static void Main(string[ ] args)

        {



            List<Student> students = new List<Student>

            {

                new Student() { name="吴松", score=89},

                new Student() { name="钱东宇", score=90},

                new Student() { name="伏晨",score=98},

                new Student() { name="陈陆",score=56},

                new Student() { name="周蕾",score=60},

                new Student() { name="林日鹏",score=91},

                new Student() { name="何昆",score=93},

                new Student() { name="关欣", score=85}

            };


            int HighScore = 0;

            string winnerName = "";

            foreach (Student v in students)

            {

                if (v.score > HighScore)

                {

                    HighScore = v.score;

                    winnerName = v.name;

                }

                

            }


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

        }

    }

}


正在回答

3 回答

你都会抢答了啊

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

good

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

good job!

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

举报

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

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

进入课程

这样可行吗

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