dariodr   03-01-2022, 15:00
#4
Tengo este codigo en VB.NET y lo quiero pasar a GAMBAS, los unicos problemas son el ReDim y el GetUpperBound, alguien sabe cual es la alternativa. Lo demas ya esta hecho.
Código:
 
Public Class Matriz5

Private mat(,) As Integer

Public Sub Cargar()
Dim filas, columnas As Integer
Console.Write("Cuantas fila tiene la matriz:")
filas = Console.ReadLine()
Console.Write("Cuantas columnas tiene la matriz:")
columnas = Console.ReadLine()
ReDim mat(filas - 1, columnas - 1)
Dim f, c As Integer
For f = 0 To mat.GetUpperBound(0)
For c = 0 To mat.GetUpperBound(1)
Console.Write("Ingrese componente:")
mat(f, c) = Console.ReadLine()
Next
Next
End Sub

Public Sub Imprimir()
Dim f, c As Integer
For f = 0 To mat.GetUpperBound(0)
For c = 0 To mat.GetUpperBound(1)
Console.Write(mat(f, c) & " ")
Next
Console.WriteLine()
Next
End Sub

Public Sub ImprimirUltimaFila()
Dim c As Integer
Console.WriteLine("Ultima fila")
For c = 0 To mat.GetUpperBound(1)
Console.Write(mat(mat.GetUpperBound(0), c) & " ")
Next
End Sub
End Class


Sub Main()
Dim ma As New Matriz5()
ma.Cargar()
ma.Imprimir()
ma.ImprimirUltimaFila()
Console.ReadKey()
End Sub 
Saludos

         Dario Delgado Razuri
Siempre aprendiendo algo nuevo
  
Usuarios navegando en este tema: 1 invitado(s)
Powered By MyBB, © 2002-2025 MyBB Group.
Made with by Curves UI.