Matrices Visual Basic

Uso de matrices en Visual Basic (Progra II clase del profesor Valdivia)

Sub main()
Dim matriz(3, 3) As Integer

Lectura matriz
presenta matriz

End Sub

Sub Lectura(matriz() As Integer)
Dim fil As Integer
Dim col As Integer

For fil = 0 To 2
For col = 0 To 2
matriz(fil, col) = InputBox("Ingrese numero [" & fil & "][" & col & "]")
Next
Next

End Sub

Sub presenta(matriz() As Integer)
Dim i As Integer
Dim j As Integer

Dim cad As String

For i = 0 To 2
For j = 0 To 2
cad = cad & matriz(i, j) & " "
Next
cad = cad & vbCrLf
Next
MsgBox (cad)

End Sub

3 comentarios: