Private Sub Form_Load() Dim a(1 To 4) As Integer Dim i, j As Integer Dim str As String For i = 1 To 4 a(i) = i Next For i = 1 To 3 For j = i + 1 To 4 str = str & "(" & a(i) & "," & a(j) & ")" Next Next Debug.Print str End Sub
Private Sub Command1_Click() Dim i As Integer Dim j As Integer Dim a() As String
a = Split("5,67,2,33", ",")
For i = 0 To UBound(a) For j = i + 1 To UBound(a) Print a(i) & IIf(Val(a(i)) > Val(a(j)), ">", "<") & a(j) Next j Next i
End Sub
Dim a(1 To 4) As Integer Dim i As Integer Dim j As Integer Dim str As String For i = 1 To 4 a(i) = i Next i For i = 1 To UBound(a) For j = i + 1 To 4 str = str & (a(i) & IIf(Val(a(i)) > Val(a(j)), ">", "<") & a(j)) Next j Next i Debug.Print str End Sub
Dim a(1 To 4) As Integer Dim x As Integer Dim y As Integer Dim b As Integer '把数付值到数组a(1 to 4)中 For X = 1 To 4 For Y = 1 To 4 - X If a(Y) < a(Y + 1) Then b = a(Y) a(Y) = a(Y + 1) a(Y + 1) = b End If Next Y Next X Print……'输出你要的形式
for t=i to 4
next
next
Private Sub Form_Load()
Dim a(1 To 4) As Integer
Dim i, j As Integer
Dim str As String
For i = 1 To 4
a(i) = i
Next
For i = 1 To 3
For j = i + 1 To 4
str = str & "(" & a(i) & "," & a(j) & ")"
Next
Next
Debug.Print str
End Sub
Dim i As Integer
Dim j As Integer
Dim a() As String
a = Split("5,67,2,33", ",")
For i = 0 To UBound(a)
For j = i + 1 To UBound(a)
Print a(i) & IIf(Val(a(i)) > Val(a(j)), ">", "<") & a(j)
Next j
Next i
End Sub
Dim i As Integer
Dim j As Integer
Dim str As String
For i = 1 To 4
a(i) = i
Next i
For i = 1 To UBound(a)
For j = i + 1 To 4
str = str & (a(i) & IIf(Val(a(i)) > Val(a(j)), ">", "<") & a(j))
Next j
Next i
Debug.Print str
End Sub
Dim x As Integer
Dim y As Integer
Dim b As Integer
'把数付值到数组a(1 to 4)中
For X = 1 To 4
For Y = 1 To 4 - X
If a(Y) < a(Y + 1) Then
b = a(Y)
a(Y) = a(Y + 1)
a(Y + 1) = b
End If
Next Y
Next X
Print……'输出你要的形式
for j=i to 4
if i>j thenelseend if
next
next