Foros del Web » Programación para mayores de 30 ;) » Programación General »

Inicializar Matriz En Vb6

Estas en el tema de Inicializar Matriz En Vb6 en el foro de Programación General en Foros del Web. ME GUSTARIA PODER INICIALIZAR UNA MATRIZ DE 10x10 EN VISUAL BASIC 6.0,CON UNOS VALORES NUMERICOS CONSTANTES. ALGO EQUIVALENTE A LO QUE EN LENGUAJE C SERIA: ...
  #1 (permalink)  
Antiguo 29/06/2004, 15:37
 
Fecha de Ingreso: mayo-2004
Mensajes: 12
Antigüedad: 19 años, 11 meses
Puntos: 0
Exclamación Inicializar Matriz En Vb6

ME GUSTARIA PODER INICIALIZAR UNA MATRIZ DE 10x10 EN VISUAL BASIC 6.0,CON UNOS VALORES NUMERICOS CONSTANTES. ALGO EQUIVALENTE A LO QUE EN LENGUAJE C SERIA:

int matriz[10][10]={20,45,67,5,21,76,..........}

HE ESTADO MIRANDO EN MANUALES Y NO HE VISTO EN NINGUN LADO COMO SE INICIALIZA UN ARRAY CON UNOS VALORES PREDETERMINADOS.

GRACIAS
  #2 (permalink)  
Antiguo 29/06/2004, 21:22
 
Fecha de Ingreso: febrero-2004
Ubicación: Resistencia - Argentina
Mensajes: 299
Antigüedad: 20 años, 2 meses
Puntos: 0
con la funcion array se puede cargar un arreglo:
Dim Matriz(1 To 5) As Integer
Matriz = Array(1, 2, 3, 4, 5)
  #3 (permalink)  
Antiguo 30/06/2004, 15:04
 
Fecha de Ingreso: mayo-2004
Mensajes: 12
Antigüedad: 19 años, 11 meses
Puntos: 0
pero...

el problema es que el array es de dos dimensiones es un 10x10 esa solucion solo me sirve si es de una???

gracias
  #4 (permalink)  
Antiguo 08/07/2004, 16:00
 
Fecha de Ingreso: junio-2004
Ubicación: Salta, Argentina
Mensajes: 27
Antigüedad: 19 años, 10 meses
Puntos: 0
yo lo que hice hace tiempo fue hacer A(1,1)= 20; A(1,2)= 45; etc, ya que no encontré un modo de hacer en forma mas rápida o eficiente.
  #5 (permalink)  
Antiguo 11/10/2007, 09:37
 
Fecha de Ingreso: octubre-2007
Mensajes: 2
Antigüedad: 16 años, 6 meses
Puntos: 0
Re: Inicializar Matriz En Vb6

dim i as integer
dim j as integer

for i = 0 to 9
for j = 0 to 9
'inicializando la matriz con cero
matrix(i,j)= 0
next
next
  #6 (permalink)  
Antiguo 12/10/2007, 07:48
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
Re: Inicializar Matriz En Vb6

Cita:
Iniciado por diosquez Ver Mensaje
dim i as integer
dim j as integer

for i = 0 to 9
for j = 0 to 9
'inicializando la matriz con cero
matrix(i,j)= 0
next
next
Es lo que se pidio y justo a tiempo
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
  #7 (permalink)  
Antiguo 12/10/2007, 08:02
 
Fecha de Ingreso: abril-2005
Mensajes: 3.083
Antigüedad: 19 años
Puntos: 17
Re: Inicializar Matriz En Vb6

Cita:
Iniciado por Eternal Idol Ver Mensaje
Es lo que se pidio y justo a tiempo
x''DDD
  #8 (permalink)  
Antiguo 15/10/2007, 13:05
 
Fecha de Ingreso: abril-2007
Mensajes: 187
Antigüedad: 17 años
Puntos: 1
Re: Inicializar Matriz En Vb6

hola, aunque parece que ya esta solucionado te dejo otra manera:

Código:
Dim V(10, 10) As Integer, x As Byte

For x = 1 To 10
  V(x, x) = 0
Next
Saludos.
  #9 (permalink)  
Antiguo 15/10/2007, 14:30
Avatar de Eternal Idol  
Fecha de Ingreso: mayo-2004
Ubicación: Lucentum
Mensajes: 6.192
Antigüedad: 19 años, 11 meses
Puntos: 74
Re: Inicializar Matriz En Vb6

Cita:
Iniciado por ReViJa Ver Mensaje
hola, aunque parece que ya esta solucionado te dejo otra manera:
Gran aporte sin dudas
__________________
¡Peron cumple, Evita dignifica! VIVA PERON CARAJO
  #10 (permalink)  
Antiguo 16/10/2007, 07:29
Avatar de _Lucifer_  
Fecha de Ingreso: junio-2006
Mensajes: 1.662
Antigüedad: 17 años, 10 meses
Puntos: 28
Re: Inicializar Matriz En Vb6

Cita:
Iniciado por ReViJa Ver Mensaje
hola, aunque parece que ya esta solucionado te dejo otra manera:

Código:
Dim V(10, 10) As Integer, x As Byte

For x = 1 To 10
  V(x, x) = 0
Next
Saludos.
¡WOW! Que capacidad tan sorprendente de desviarse del tema...amigo mio, lo que querían era inicializar en distintos valores constantes, en segundo lugar eso solo llena la diagonal principal, en tercer lugar y creo que más importante el post es de hace varios años :
Cita:
29/06/04 17:37:58
__________________
Si crees que no tiene sentido, etonces probablemente lo tenga... :arriba:
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas (incluyéndote)




La zona horaria es GMT -6. Ahora son las 17:15.