total = Sheets(\排名\Dim Info(30) As String '队名 Dim result(30) As Double '队胜率 Dim Code(30) As Integer '队号 For i = 2 To total '获取信息 Code(i - 1) = Cells(i, 1) '队号 Info(i - 1) = Cells(i, 2) '对名 result(i - 1) = Cells(i, 5) '胜率成绩 Next i
total = total - 1 '从前往后排名
For i = 1 To total - 1 For j = i + 1 To total If result(j) > result(i) Then temp1 = result(i) result(i) = result(j) result(j) = temp1 '成绩交换 temp2 = Code(i) Code(i) = Code(j)
Code(j) = temp2 '队号交换 temp3 = Info(i) Info(i) = Info(j)
Info(j) = temp3 '交换队名称 End If Next j Next i '输出排名
Cells(1, 7) = \排名\ Cells(1, 8) = \队号\ Cells(i, 9) = \队名\
21
Cells(i, 10) = \胜率\ For i = 1 To total Cells(i + 1, 7) = i Cells(i + 1, 8) = Code(i) Cells(i + 1, 9) = Info(i) Cells(i + 1, 10) = result(i) Next i End Sub
22
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库数学建模08D题(5)在线全文阅读。
相关推荐: