goback add

计算机二级VB常用算法:补充代码

3720 点击·0 回帖
灯火互联
楼主


补充代码
  本程序的功能是在二维数组中查找鞍点元素,即该元素在所在行中为最大,且在所在列中为最小。在一个数组中可能存在,也可能不存在这样的元素。数组各元素的值从文件data.txt中读取。
以下是片段:
  Private Sub Form_Click()
  Dim a(3,3) As Integer,i As Integer,j As Integer
  Dim maxvr As Integer,col As Integer, As Integer
  Open data.txt For Input As #1
  For i=1 To 3
  For j=1 To 3
  Input #1,a(i,j)
  Print a(i,j);
  Next j
  Print
  Next i
  For i=1 To 3
  maxvr= (1)
  col=1
  For j=2 To 3
  If maxvr
  maxvr= (2)
  col=j
  End If
  Next j
  For j=1 To 3
  If maxvr>a(j,col) Then (3)
  Next j


喜欢0 评分0