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)
If Max < a(i, j) Then
Max = a(i, j)
x = i
y = j
End If
Print "最大值為" & Max & "在第" & x & "行" & y & "列"
End Sub
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