嗨,我有一个项目,要求我冒泡排序患者名单。我怎么能用这段代码来做呢:
Swapped = True
While Swapped = True
Swapped = False
ComparisonNumber = 0
While ComparisonNumber < PatientCount
If Names(ComparisonNumber) > Names(ComparisonNumber + 1) Then
Temp = Names(ComparisonNumber)
Names(ComparisonNumber) = Names(ComparisonNumber + 1)
Names(ComparisonNumber + 1) = Temp
Swapped = True
End If
ComparisonNumber = ComparisonNumber + 1
End While
End While
而不是Names()我有一个项目列表:
Public Class Patient
Public Property Name As String
Public Property Height As Decimal
Public Property Weight As Decimal