level 1
Private Function Sum1(a() As Integer) As Integer
Dim i As Integer, j As Integer
For i = LBound(a, 1) To UBound(a, 1)
For j = LBound(a, 2) To UBound(a, 2)
Sum1 = Sum1 + a(i, j)
Next j
Next i
End Function
'求不靠谱(
Private Function Sum2(a() As Integer) As Integer
Dim i As Integer, j As Integer
For i = LBound(a, 1) + 1 To UBound(a, 1) - 1
For j = LBound(a, 2) + 1 To UBound(a, 2) - 1
Sum2 = Sum2 + a(i, j)
Next j
Next i
End Function
'“运行”按钮的代码,调用以上两个函数完成计算
Dim a(1 To 5, 1 To 5) As Integer
Dim i As Integer, j As Integer
Randomize
For i = 1 To 5
For j = 1 To 5
a(i, j) = Int(Rnd * 9) + 1
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
Text1.Text = Sum1(a)
Text2.Text = Sum2(a)
