Dim l As Integer, c As Integer, mat(1 To 6, 1 To 6) As Integer, maior As Integer, posl As Integer, posc As Integer
Randomize
Picture1.Cls
For l = 1 To 6
For c = 1 To 6
mat(l, c) = Int(Rnd() * 50) + 1
Next c
Next l
For l = 1 To 6
For c = 1 To 6
Picture1.Print mat(l, c);
Next c
Picture1.Print Chr(13)
Next l
maior = mat(1, 1)
posl = 1
posc = 1
For l = 1 To 6
For c = 1 To 6
If mat(l, c) > maior Then
maior = mat(l, c)
posl = l
posc = c
End If
Next c
Next l
MsgBox "O maior valor da matriz é: " & maior & Chr(13) & "linha: " & posc & "coluna: " & posc, vbOKOnly + vbInformation, "resultado"
End Sub
Private Sub Command2_Click()
If MsgBox("Quer mmesmo sair?", vbOKCancel + vbQuestion) Then
End
End If
End Sub

Sem comentários:
Enviar um comentário