ok so there are 300 numbers in a text file, they are all out of order and im just trying to print all of them in order from smallest to biggest
i really need some help, please dont just direct me to another topic about this unless its exactly like the help i need
this is teh code i have so far, but it wont work
thank you so much, hopefully someone knows whats wrong
VB Code:
Dim nom(1 To 300) Private Sub Form_Load() Dim count As Single Open "NUMBERS.TXT" For Input As #1 Do While EOF(1) = False count = count + 1 Input #1, nom(count) Loop Close #1 End Sub Private Sub cmdCalculate_click() Call Sort Call Show End Sub Private Sub Showz() Dim i As Integer picOutput.Cls For i = 1 To 300 picOutput.Print nom(count) Next i End Sub Private Sub Sort() Dim passNum As Single, count2 As Single 'Bubble sort table in descending order by population For passNum = 1 To 299 For count2 = 1 To 300 - passNum If nom(count2) > nom(count2 + 1) Then temp = nom(count2) nom(count2) = nom(count2 + 1) nom(count2 + 1) = temp End If Next count2 Next passNum End Sub




Reply With Quote