Una AYuDITA PliSS!! - // Matrices
Publicado por Maria - FlisH! (2 intervenciones) el 24/11/2004 16:38:33
Alguien me podria mirar que esta mal en este codigo, pliS!!, no me ordena los valores. Que tendria q canviar en el codigo que hay mas abajo?
Private Sub Command1_Click()
'COLUMNA UNO
arrNotas(0, 0) = 0
arrNotas(1, 0) = 7
arrNotas(2, 0) = 3
arrNotas(3, 0) = 1
arrNotas(4, 0) = 9
arrNotas(5, 0) = 4
arrNotas(6, 0) = 5
arrNotas(7, 0) = 6
'COLUMNA DOS
arrNotas(0, 1) = 0
arrNotas(1, 1) = 7
arrNotas(2, 1) = 3
arrNotas(3, 1) = 1
arrNotas(4, 1) = 9
arrNotas(5, 1) = 4
arrNotas(6, 1) = 5
arrNotas(7, 1) = 6
'ORDENANDO - AQUÍ ES DONDE FALTA CODIGO.
For i = LBound(arrNotas) To UBound(arrNotas) - 1 'X
For j = LBound(arrNotas) To UBound(arrNotas) - 1 'Y
If arrNotas(j) > arrNotas(j + 1) Then
aux = arrNotas(j)
arrNotas(j) = arrNotas(j + 1)
arrNotas(j + 1) = aux
End If
Next j
Next i
'MOSTRANDO VALORES YA ORDENADOS
MsgBox arrNotas(0, 0)
MsgBox arrNotas(1, 0)
MsgBox arrNotas(2, 0)
MsgBox arrNotas(3, 0)
MsgBox arrNotas(4, 0)
MsgBox arrNotas(5, 0)
MsgBox arrNotas(6, 0)
MsgBox arrNotas(7, 0)
MsgBox arrNotas(0, 1)
MsgBox arrNotas(1, 1)
MsgBox arrNotas(2, 1)
MsgBox arrNotas(3, 1)
MsgBox arrNotas(4, 1)
MsgBox arrNotas(5, 1)
MsgBox arrNotas(6, 1)
MsgBox arrNotas(7, 1)
End Sub
Gracias al wapo que me conteste! MuackS!
Private Sub Command1_Click()
'COLUMNA UNO
arrNotas(0, 0) = 0
arrNotas(1, 0) = 7
arrNotas(2, 0) = 3
arrNotas(3, 0) = 1
arrNotas(4, 0) = 9
arrNotas(5, 0) = 4
arrNotas(6, 0) = 5
arrNotas(7, 0) = 6
'COLUMNA DOS
arrNotas(0, 1) = 0
arrNotas(1, 1) = 7
arrNotas(2, 1) = 3
arrNotas(3, 1) = 1
arrNotas(4, 1) = 9
arrNotas(5, 1) = 4
arrNotas(6, 1) = 5
arrNotas(7, 1) = 6
'ORDENANDO - AQUÍ ES DONDE FALTA CODIGO.
For i = LBound(arrNotas) To UBound(arrNotas) - 1 'X
For j = LBound(arrNotas) To UBound(arrNotas) - 1 'Y
If arrNotas(j) > arrNotas(j + 1) Then
aux = arrNotas(j)
arrNotas(j) = arrNotas(j + 1)
arrNotas(j + 1) = aux
End If
Next j
Next i
'MOSTRANDO VALORES YA ORDENADOS
MsgBox arrNotas(0, 0)
MsgBox arrNotas(1, 0)
MsgBox arrNotas(2, 0)
MsgBox arrNotas(3, 0)
MsgBox arrNotas(4, 0)
MsgBox arrNotas(5, 0)
MsgBox arrNotas(6, 0)
MsgBox arrNotas(7, 0)
MsgBox arrNotas(0, 1)
MsgBox arrNotas(1, 1)
MsgBox arrNotas(2, 1)
MsgBox arrNotas(3, 1)
MsgBox arrNotas(4, 1)
MsgBox arrNotas(5, 1)
MsgBox arrNotas(6, 1)
MsgBox arrNotas(7, 1)
End Sub
Gracias al wapo que me conteste! MuackS!
Valora esta pregunta


0