Cuando llega el codigo al algoritmo de la burbuja, no me ordena los vaores de la matriz, no puedo poner muchos for, esa es la pregunta.
Un salduo
Gracias
Private Sub Command1_Click()
Dim numescaños As Double
numescaños = Val(Text3.Text - 1)
Dim temp, n As Double
Dim hasta As Double
Dim m As Double
n = Val(4 * (numescaños + 1))
Dim i, j As Double
ReDim matriz(numescaños, 3)
ReDim vector(n)
Dim votos(3) As Long
m = 0
matriz(0, 0) = Text1(0).Text
matriz(0, 1) = Text1(1).Text
matriz(0, 2) = Text1(2).Text
matriz(0, 3) = Text1(3).Text
vector(0) = Text1(0).Text
vector(1) = Text1(1).Text
vector(2) = Text1(2).Text
vector(3) = Text1(3).Text
minimo = -3
For i = 1 To numescaños
minimo = minimo + 3
For j = 0 To 3
dimension = Val(i + j + minimo + 3)
matriz(i, j) = Val(matriz(0, j) / (i + 1))
vector(dimension) = Val(matriz(0, j) / (i + 1))
'MsgBox (matriz(i, j))
Next
Next
For z = 0 To n - 1
For x = 0 To n
If vector(x) > vector(x + 1) Then
temp = vector(x)
vector(x + 1) = vector(x)
vector(x) = temp
End If
Next x
Next z
For a = 0 To n - 1
MsgBox (vector(a))
Next
hasta = vector(numescaños)
MsgBox (hasta)
MsgBox (hasta)
For t = 0 To 3
votos(t) = 0
Next
For x = 0 To numescaños
For j = 0 To 3
If matriz(x, j) > hasta Then
votos(j) = Val(votos(j) + 1)
k = k + 1
Else
End If
Next
Next
MsgBox (k)
For z = 0 To 3
MsgBox (votos(z))
Next
End Sub
Un salduo
Gracias
Private Sub Command1_Click()
Dim numescaños As Double
numescaños = Val(Text3.Text - 1)
Dim temp, n As Double
Dim hasta As Double
Dim m As Double
n = Val(4 * (numescaños + 1))
Dim i, j As Double
ReDim matriz(numescaños, 3)
ReDim vector(n)
Dim votos(3) As Long
m = 0
matriz(0, 0) = Text1(0).Text
matriz(0, 1) = Text1(1).Text
matriz(0, 2) = Text1(2).Text
matriz(0, 3) = Text1(3).Text
vector(0) = Text1(0).Text
vector(1) = Text1(1).Text
vector(2) = Text1(2).Text
vector(3) = Text1(3).Text
minimo = -3
For i = 1 To numescaños
minimo = minimo + 3
For j = 0 To 3
dimension = Val(i + j + minimo + 3)
matriz(i, j) = Val(matriz(0, j) / (i + 1))
vector(dimension) = Val(matriz(0, j) / (i + 1))
'MsgBox (matriz(i, j))
Next
Next
For z = 0 To n - 1
For x = 0 To n
If vector(x) > vector(x + 1) Then
temp = vector(x)
vector(x + 1) = vector(x)
vector(x) = temp
End If
Next x
Next z
For a = 0 To n - 1
MsgBox (vector(a))
Next
hasta = vector(numescaños)
MsgBox (hasta)
MsgBox (hasta)
For t = 0 To 3
votos(t) = 0
Next
For x = 0 To numescaños
For j = 0 To 3
If matriz(x, j) > hasta Then
votos(j) = Val(votos(j) + 1)
k = k + 1
Else
End If
Next
Next
MsgBox (k)
For z = 0 To 3
MsgBox (votos(z))
Next
End Sub