VB中出现编译错误,必选参数
OptionExplicitOptionBase1PrivateSubCommand1_Click()DimA(4,4)AsInteger,iAsInteger,jAsI...
Option Explicit
Option Base 1
Private Sub Command1_Click()
Dim A(4, 4) As Integer, i As Integer, j As Integer, k As Integer
For i = 1 To 4
For j = 1 To 4
k = k + 1
A(i, j) = k
Next j
Next i
Call transform(A)
For i = 1 To 4
For j = 1 To 4
Text1 = Text1 & Right(" " & A(i, j))
Next j
Text1 = Text1 & vbCrLf
Next i
End Sub
Private Sub transform(A() As Integer)
Dim i As Integer, j As Integer, n As Integer, t As Integer, k As Integer
n = UBound(A, 1)
k = n + 1
For i = 1 To n / 2
For j = 1 To n
If i <> j And j <> k - i Then
t = A(i, j)
A(i, j) = A(k - i, k - j)
A(k - i, k - j) = t
End If
Next j
Next i
End Sub 展开
Option Base 1
Private Sub Command1_Click()
Dim A(4, 4) As Integer, i As Integer, j As Integer, k As Integer
For i = 1 To 4
For j = 1 To 4
k = k + 1
A(i, j) = k
Next j
Next i
Call transform(A)
For i = 1 To 4
For j = 1 To 4
Text1 = Text1 & Right(" " & A(i, j))
Next j
Text1 = Text1 & vbCrLf
Next i
End Sub
Private Sub transform(A() As Integer)
Dim i As Integer, j As Integer, n As Integer, t As Integer, k As Integer
n = UBound(A, 1)
k = n + 1
For i = 1 To n / 2
For j = 1 To n
If i <> j And j <> k - i Then
t = A(i, j)
A(i, j) = A(k - i, k - j)
A(k - i, k - j) = t
End If
Next j
Next i
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询