Option Base 1
Option Explicit
Private Sub Command1_Click()
Cls 'æµè¯æ¶å»ºè®®å ä¸è¿å¥ï¼å 为ç»ææéç¹çæ¦çè¾ä½ï¼å¤éå 次æé®æå¯è½åºç°ä¸æ¬¡æéç¹çæ
åµ
Dim a(6, 5) As Integer, f As Boolean, i As Integer, j As Integer
Dim k As Integer, col As Integer, max As Integer
Randomize
For i = 1 To 6
For j = 1 To 5
a(i, j) = Int(Rnd * 90 + 10)
Print a(i, j);
Next j
Print
Next i
'éç¹çææå°±æ¯å¨ä¸è¡ä¸çæ大å¼ä¹æ¯è¯¥åçæå°å¼
f = False
For i = 1 To 6 'ä»ç¬¬ä¸è¡æ¥æ¾å°ç¬¬å
è¡
max = a(i, 1): col = 1
For j = 2 To 5
If a(i, j) >= max Then
max = a(i, j): col = j
End If
Next j
'以ä¸äºå¥ç¨åºçåè½æ¯æ¾åºè¯¥è¡çæ大å¼ï¼å¹¶è®°ä¸å
¶ä½ç½®
'以ä¸ä¸å¥å¤ææ¾åºçè¡çæ大å¼æ¯å¦æ¯å®æå¨çåçæå°å¼
For k = 1 To 6
If a(k, col) < a(i, col) Then Exit For 'å¦ææ¡ä»¶ä¸æ»¡è¶³ï¼ç»æå循ç¯ï¼å
¶ç»ææ¯æ¡ä»¶æç«æ¶kçå¼å°äº7
Next k
If k = 7 Then 'å¦æk=7,é£ä¹ä¸é¢çå循ç¯æ²¡ææåç»æï¼ä¹å°±æ¯å¯¹äºè¯¥åçæ¯ä¸ä¸ªæ°é½ä¸å°äºææ¾åºçåçæ大å¼ï¼å³æ»¡è¶³éç¹çæ¡ä»¶
Print "éç¹æ¯ï¼a(" & i & "ï¼" & col & ")"
f = True 'å°f设置为true,æ 示æ¾å°éç¹
End If
Next i
If f = False Then Print "没æéç¹" 'å¦æ没æéç¹ï¼è¾åºæ²¡æéç¹
End Sub
温馨提示:答案为网友推荐,仅供参考