이 프로그램을 사용하여 높은 점수의 게임을 정렬 한 다음 Using LISTS라는 사용자 이름으로 가장 큰 점수를 표시합니다. 지금까지 내가 쓴 :VB에서 정수 내림차순으로 정수 및 문자열 목록 정렬
Public highscore As New List(Of HighScores)
highscore.Add(New HighScores("Jeremias", 6))
highscore.Add(New HighScores("Tom", 1))
highscore.Add(New HighScores("sdf", 5))
highscore.Add(New HighScores("asfd", 1))
highscore.Sort()
highscore.Reverse()
Console.WriteLine("------High Scores-----")
For Each scores In highscore
Console.WriteLine(scores)
Next
Console.WriteLine("----------------------")
그리고 최고 기록 등급 :
이Public Class HighScores
Public name As String
Public score As Integer
Public Sub New(ByVal name As String, ByVal score As Integer)
Me.name = name
Me.score = score
End Sub
Public Overrides Function ToString() As String
Return String.Format("{0}, {1}", Me.name, Me.score)
End Function
End Class
보통 난 그냥 목록을 정렬 할 .Sort()와 .Reverse()를 사용하는 것이지만,이 경우 내가 돈 내가이 일을 할 수 있다고 생각하지 않아. 모든 아이디어를 어떻게이/그냥 목록을 쉽게 다시 작성할 수 있습니다?
감사합니다. –