使用inputbox任意輸入5個數到數組A中?
Dim a(1 To 5) As Single, i As Integer, j As IntegerPrivate Sub form_Click()ClsPrint "排序后:"For i = 1 To 5a(i) = Val(inputbox("請輸入第" & i & "個元素的值"))Next iFor i = 1 To 4For j = i + 1 To 5If a(i) > a(j) Thent = a(i): a(i) = a(j): a(j) = tEnd IfNextNextFor j = 1 To 5Print a(j);NextEnd Sub