metodo burbuja
Publicado por aris (10 intervenciones) el 25/11/2005 19:04:12
hola necesito hacerr un programa en donde el usuario al introducir las temperaturas me las ordene por medio del metodo burbuja tengo esto:
Dim arrtemp()
total = Val(Text1.Text)
ReDim arrtemp(total)
For i = 0 To total
arrtemp(i) = InputBox("introduce las temperaturas")
Print arrtemp(i)
Next i
For i = 1 To (total - 1) Step 1
For j = 1 To total Step 1
If arrtemp( j ) < arrtemp( j - 1 ) Then
aux = arrtemp( j )
arrtemp( j ) = arrtemp( j - 1 )
arrtemp( j - 1 ) = aux
Label4.Caption = arrtemp(i)
End If
Next j
Next i
end sub
No se donde esta mi error que no me las ordena solo me muestra un numero. agradeceria tu ayuda.
Dim arrtemp()
total = Val(Text1.Text)
ReDim arrtemp(total)
For i = 0 To total
arrtemp(i) = InputBox("introduce las temperaturas")
Print arrtemp(i)
Next i
For i = 1 To (total - 1) Step 1
For j = 1 To total Step 1
If arrtemp( j ) < arrtemp( j - 1 ) Then
aux = arrtemp( j )
arrtemp( j ) = arrtemp( j - 1 )
arrtemp( j - 1 ) = aux
Label4.Caption = arrtemp(i)
End If
Next j
Next i
end sub
No se donde esta mi error que no me las ordena solo me muestra un numero. agradeceria tu ayuda.
Valora esta pregunta


0