1 Dim a(1 To 15)
Dim b(1 To 15)
Private Sub Form_Load()
Randomize
For i = 1 To 15
a(i) = Int(Rnd * 100 + 1)
Next i
For i = 1 To 15
b(i) = a(i)
Next i
k = 0
While k = 0
k = 1
For i = 1 To 14
p = i + 1
If a(i) < a(p) Then
v = a(i)
a(i) = a(p)
a(p) = v
k = 0
End If
Next i
Wend
MsgBox b(1) & "," & b(2) & "," & b(3) & "," & b(4) & "," & b(5) & "," & b(6) & "," & b(7) & "," & b(8) & "," & b(9) & "," & b(10) & "," & b(11) & "," & b(12) & "," & b(13) & "," & b(14) & "," & b(15)
MsgBox a(1) & "," & a(2) & "," & a(3) & "," & a(4) & "," & a(5) & "," & a(6) & "," & a(7) & "," & a(8) & "," & a(9) & "," & a(10) & "," & a(11) & "," & a(12) & "," & a(13) & "," & a(14) & "," & a(15)
End Sub
VB6.0实践可行
Function A(x,y)
If x > 0 And y > 0 Then
p = x * y
w = x * x + Sin(p) + 2 * y
Else
w = 0
End If
A = w
Exit Function
End Function