03-05-2023, 05:55 PM
This is the principle of sorting numbers in a one-dimensional array as I use it. There are better procedures, but hopefully this will help.
Code: (Select All)
'vygeneruju nahodna cisla
Dim A(100) As Long
For bb = 0 To 100
Randomize Timer
A(bb) = 32768 * (1 + bb * Rnd)
Next
'udelam druhe prazdne pole stejne velikosti pro vysledky
Dim B(100) As Long
'porovnam to
For komplet = 0 To 100
hodnota = 0
For s = 0 To 100
If A(s) > -1 Then 'pokud tato hodnota jeste nebyla prirazena - prirazene hodnoty nastavuji na -1 abych jednu hodnotu neulozil vicekrat
If hodnota < A(s) Then hodnota = A(s): zaznam = s
End If
Next s
B(komplet) = hodnota
A(zaznam) = -1
Next komplet
'vypis
For v = 0 To 100
Print "zaznam:"; Str$(v); " - "; B(v)
Sleep
Next