這樣可行嗎
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="關(guān)欣", score=85}
? ? ? ? ? ? };
? ? ? ? ? ? int HighScore = 0;
? ? ? ? ? ? string winnerName = "";
? ? ? ? ? ? foreach (Student v in students)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (v.score > HighScore)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? HighScore = v.score;
? ? ? ? ? ? ? ? ? ? winnerName = v.name;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ??
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}", winnerName, HighScore);
? ? ? ? }
? ? }
}
2016-06-04
你都會(huì)搶答了啊
2016-05-31
good
2016-05-31
good job!