2024-05-19 02:28:55
'VB语言程序:
Private Sub Command1_Click()
Dim a(1 To 5, 1 To 5) As Integer, valMax As Single
For i = 1 To 5
For j = 1 To 5
a(i, j) = InputBox("a(" & i & "," & j & ")=")
Print a(i, j);
Next j
Next i
For i = 1 To 5
If a(i, i) > valMax Then valMax = a(i, i)
Next i
For i = 1 To 5
If a(i, 5 - i + 1) > valMax Then valMax = a(i, i)
Next i
Print "对角线上元素的最大值为:"; valMax
End Sub
2024-05-19 08:25:59