回复 楼主 xstawt
程序代码:
Option Explicit
Dim a(4, 4) As Single
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Text1.Text = ""
For i = 0 To 4
For j = 0 To 4
a(i, j) = Round(Rnd, 3)
Text1.Text = Text1.Text & a(i, j) & " "
Next
Text1.Text = Text1.Text & vbCrLf
Next
Text1.Text = Text1.Text & vbCrLf
judge
End Sub
Private Sub Form_Load()
Me.Show
End Sub
Sub judge()
Dim i As Integer, j As Integer, k As Integer
Dim rowmax As Single
Dim rowmaxp
Dim s As Boolean 'Is the maxmium number of a column ture:yes false:no
For i = 0 To 4
rowmax = 0
For j = 0 To 4
If a(i, j) > rowmax Then
rowmax = a(i, j)
rowmaxp = j
End If
Next
s = True
For k = 0 To 4
If rowmax < a(k, rowmaxp) Then s = False: Exit For
Next
If s = True Then Text1.Text = Text1.Text & rowmax & " in the " & i & " Row" & " is the maxmium number of the " & rowmaxp & " column" & vbCrLf
Next
End Sub