Sub bąbelkowe()
Dim t(1 To 100) As Integer
For i = 1 To 100
t(i) = Rnd * 100
Next i
i = 1
For i = 1 To 100
x = t(i)
Range("A1").Offset(i, 0) = x
Next i
i = 1
For i = 1 To 99
If t(i) > t(i + 1) Then
t(i) = t(i) + t(i + 1)
t(i + 1) = t(i) - t(i + 1)
t(i) = t(i) - t(i + 1)
i = 0
End If
Next i
i = 1
For i = 1 To 100
x = t(i)
Range("B1").Offset(i, 0) = x
Next i
End Sub
Sub wybieranie()
Dim t(1 To 100) As Integer
For i = 1 To 100
t(i) = Rnd * 100
Next i
i = 1
For i = 1 To 100
x = t(i)
Range("A1").Offset(i, 0) = x
Next i
i = 2
k = 1
m = t(k)
For k = 1 To 99
n = k
m = t(k)
For i = k + 1 To 100
If t(i) < m Then
m = t(i)
n = i
End If
Next i
t(n) = t(k)
t(k) = m
Next k
i = 1
For i = 1 To 100
x = t(i)
Range("B1").Offset(i, 0) = x
Next i
End Sub
Wyszukiwarka
Podobne podstrony:
Ewangelia Pseudo Mateuszapseudokody 22T88 2Pseudohydnum gelatinosumKONWERTER z 88 108Mhz na 64 74Mhz opisKurant do zegara pseudoanalogowegopseudoelementywięcej podobnych podstron