打印以下数组, 并将对角线的数的和放在文本框中。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 VB

2024-12-05 03:47:14
推荐回答(3个)
回答1:

Private Sub Form_Load()
Dim a(1 To 4, 1 To 4) As Integer
Dim s As Integer
Me.AutoRedraw = True
For i = 1 To 4
For j = 1 To 4
a(i, j) = i * 4 + j
Print Tab(4 * j); a(i, j);
If i = j Then s = s + a(i, j)

Next j
Print
Next i
Text1.Text = Str(s)
End Sub

回答2:

iiiiii

回答3:

i