Option Base 1
'm*n的二维数组,m行n列
Dim anma() As Integer
Dim m As Byte, n As Byte
Private Sub Command1_Click()
Cls
Me.Font.Size = 30
'生成二维数组
'dim m as byte
m = 5: n = 6
ReDim anma(m,n)
'此时数组里全是0
'我们用一个双重循环来附初值
'i---m:j---m
Dim i As Byte, j As Byte
For i = 1 To m
For j = 1 To n
anma(i, j) = 10 + Int(Rnd * 90)
'print anma(i,j);spc(3)
Next j
Print
Next i
'k-----?
'对数组进行分析
'row_max表示当前行的最大值
'column_max表示所找的最大值所在的列号
Dim row_max As Integer, column_max As Byte
For i = 1 To m
row_max = anma(i, 1)
column_max = 1
For j = 2 To n
If anma(i, j) > row_max Then
row_max = anma(i, j)
column_max = j
End If
Next j
For k = 1 To m
If anma(k, column_max) < row_max Then
Exit For
End If
Next k
If k = m + 1 Then
Print "鞍点:" & i&; "," & column_max
End If
Next i
End Sub
'm*n的二维数组,m行n列
Dim anma() As Integer
Dim m As Byte, n As Byte
Private Sub Command1_Click()
Cls
Me.Font.Size = 30
'生成二维数组
'dim m as byte
m = 5: n = 6
ReDim anma(m,n)
'此时数组里全是0
'我们用一个双重循环来附初值
'i---m:j---m
Dim i As Byte, j As Byte
For i = 1 To m
For j = 1 To n
anma(i, j) = 10 + Int(Rnd * 90)
'print anma(i,j);spc(3)
Next j
Next i
'k-----?
'对数组进行分析
'row_max表示当前行的最大值
'column_max表示所找的最大值所在的列号
Dim row_max As Integer, column_max As Byte
For i = 1 To m
row_max = anma(i, 1)
column_max = 1
For j = 2 To n
If anma(i, j) > row_max Then
row_max = anma(i, j)
column_max = j
End If
Next j
For k = 1 To m
If anma(k, column_max) < row_max Then
Exit For
End If
Next k
If k = m + 1 Then
Print "鞍点:" & i&; "," & column_max
End If
Next i
End Sub