A=(35;22;56;12;)
由程式讓A由小排到大
也就是 A=(12;22;35;56)
請幫我解題.謝謝
*
答案由MSGBOX回應 _
原資料:35:22:56:12:
排列後:12:22:35:56
2007-03-21 15:02:29 · 1 個解答 · 發問者 iam_1_001 5 in 電腦與網際網路 ➔ 程式設計
聰明微笑_兄:
好!有關所提回答.是ok了.
但我想在請教.
如果有20組以上.是否有替代的程式.還是得 A(20).....至A(0)手寫..
請再度幫忙....
聰明微笑_兄:
拜託.幫我解釋下一道題.拜託了!
http://tw.knowledge.yahoo.com/question/question?qid=1507031501984
2007-03-21 19:24:43 · update #1
Dim A
Dim T As Integer
Dim I As Integer
Dim J As Integer
A = Array(35, 22, 56, 12)
For I = 0 To 2
For J = I + 1 To 3
If A(I) < A(J) Then
T = A(I)
A(I) = A(J)
A(J) = T
End If
Next J
Next I
MsgBox "原資料 35:22:56:12"
MsgBox "排序後 " & A(3) & ":" & A(2) & ":" & A(1) & ":" & A(0)
2007-03-21 17:10:22 · answer #1 · answered by ×`罐_v 3 · 0⤊ 0⤋