vb 缺少数组
OptionExplicitDima(1To3,1To3)AsInteger,iAsInteger,jAsIntegerPrivateSubCommand1_Click(...
Option Explicit
Dim a(1 To 3, 1 To 3) As Integer, i As Integer, j As Integer
Private Sub Command1_Click()
Randomize
For i = 1 To 3
For j = 1 To 3
a(i, j) = Int(90 * Rnd) + 10
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
End Sub
Private Sub Command2_Click()
Dim min As Integer, a As Integer, b As Integer
min = a(1, 1)
For i = 1 To 3
For j = 1 To 3
If a(i, j) < min Then
min = a(i, j)
a = i
b = j
End If
Next j
Next i
t = a(2, 2)
a(2, 2) = a(a, b)
a(a, b) = t
For i = 1 To 3
For j = 1 To 3
Picture2.Print a(i, j);
Next j
Picture2.Print
Next i
End Sub 展开
Dim a(1 To 3, 1 To 3) As Integer, i As Integer, j As Integer
Private Sub Command1_Click()
Randomize
For i = 1 To 3
For j = 1 To 3
a(i, j) = Int(90 * Rnd) + 10
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
End Sub
Private Sub Command2_Click()
Dim min As Integer, a As Integer, b As Integer
min = a(1, 1)
For i = 1 To 3
For j = 1 To 3
If a(i, j) < min Then
min = a(i, j)
a = i
b = j
End If
Next j
Next i
t = a(2, 2)
a(2, 2) = a(a, b)
a(a, b) = t
For i = 1 To 3
For j = 1 To 3
Picture2.Print a(i, j);
Next j
Picture2.Print
Next i
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询