Private Sub Form_Click()
Dim arr(1 To 5, 1 To 5), i, j, sum
Cls
For i = 1 To 5
For j = 1 To 5
arr(i, j) = Val(InputBox("输入一个数:"))
Print arr(i, j),
Next
Print
Next
For i = 1 To 5
For j = 1 To 5
If i = j Or i = 5 - j + 1 Then
sum = sum + arr(i, j)
If i = 3 And j = 3 Then sum = sum + arr(i, j) '对角线交叉的这个数需要加2次
End If
Next
Next
Print sum
End Sub
下面的正确!!!!!