第1个回答 推荐于2016-03-11
Dim a(5, 5) As Integer
Private Sub Command1_Click()
'Randomize
Text1 = " "
For i = 1 To 5
For j = 1 To 5
a(i, j) = Int(Rnd * 10)
Text1 = Text1 & a(i, j) & " "
Next j
Text1 = Text1 & vbCrLf & " "
Next i
End Sub
Private Sub Command2_Click()
Text2 = ""
For i = 1 To 5
s = 0
For j = 1 To 5
s = s + a(i, j)
Next j
Text2 = Text2 & s & vbCrLf
Next i
End Sub
Private Sub Command3_Click()
Text3 = ""
For j = 1 To 5
s = 0
For i = 1 To 5
s = s + a(i, j)
Next i
Text3 = Text3 & s & " "
Next j
End Sub
Private Sub Command4_Click()
For i = 1 To 5
s = s + a(i, i)
Next i
Text4 = s
End Sub
Private Sub Command5_Click()
For i = 1 To 5
s = s + a(i, 6 - i)
Next i
Text5 = s
End Sub
Private Sub Command6_Click()
For i = 1 To 5
For j = 1 To 5
s = s + a(i, j)
Next j, i
Text6 = s
End Sub本回答被提问者和网友采纳