VB编程题:求二维数组a(m,n)中的最大值以及最大值所在的行号和列号,行数m、列数n及数组元素从键盘输入;

请用VB的方法解答,谢谢

Private Sub Command1_Click()
Dim a() As Integer
m = InputBox("请输入行数m:")
n = InputBox("请输入列数n:")
ReDim a(m, n)
For i = 1 To m
For j = 1 To n
a(i, j) = InputBox("请输入a(" & i & "," & j & ")")
Print a(i, j);
Next j
Print
Next i
Max = a(1, 1)
For i = 1 To m
For j = 1 To n
If Max < a(i, j) Then
Max = a(i, j)
x = i
y = j
End If
Next j
Next i
Print
Print "最大值为" & Max & "在第" & x & "行" & y & "列"
End Sub
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答