请帮忙编下,俺实在不会厄~谢谢了!
Option Explicit
'输入对话框输入15个数值数据放入数组a。
'将其中的整数放入数组b,
'然后运用选择法将数组b中的数据按从大到小排序,
'并将数组b以每行10个数据在窗体上输出。
'请帮忙编下,俺实在不会厄~谢谢了!
Private Sub Command1_Click()
Cls
Dim i As Long, j As Long, lNum As Single
Dim a(14) As Single, b(14) As Long, tmp As Long
For i = 0 To 14
lNum = Val(InputBox("请输入第" & i + 1 & "个数据", "输入"))
a(i) = lNum
If InStr(lNum, ".") > 0 Then
Else
b(j) = lNum
j = j + 1
End If
Next
For i = 0 To UBound(b)
For j = i + 1 To UBound(b)
If b(i) < b(j) Then
'交换两数
tmp = b(i): b(i) = b(j): b(j) = tmp
End If
Next j
Next i
For i = 0 To UBound(b)
If i Mod 10 = 0 And i <> 0 Then Print
Print "b(" & i & ")=" & b(i) & Space(3);
Next
End Sub