因为题目未说明n*m的矩阵的来源,所以这里假设矩阵已经存放在一个数组MyMatrix(N,M)中,用N行,M列,则查找最大元素的程序部分如下:<br/>Dim MAX, Max_Line, Max_Column As Integer
Dim I, J As Integer<br/>MAX = 0
For I = 0 to N-1
For J = 0 to M-1
If MyMatrix(I,J)MAX then
MAX = MyMatrix(I,J)
Max_Line = I
Max_Column = J
End If
Next J
Next I
Print \\\"最大元素为:\\\"MAX\\\"; 行值:\\\"Max_Line\\\"; 列值:\\\"Max_Column<br/>
|