Program dzieki, któremu możemy posortować liczby w kolejności rosnącej.
Dim strA(10) As String * 5, strP As String * 5
Dim strMax As String * 5
Dim intI As Integer, IntN As Integer, intK As Integer
Private Sub Dane_Click()
' Wprowadzam liczbę elementów ciągu <= 9
IntN = CInt(InputBox("Wprowadź liczbę elementów", "Liczba el"))
' Wprowadzam dane początkowe
For intI = 0 To IntN - 1
txtintA(intI) = InputBox("Podaj wartość", "Dane ciągu")
strA(intI) = txtintA(intI)
Next intI
End Sub
Private Sub Koniec_Click()
Unload Me
End
End Sub
Private Sub Sortuj_Click()
For intI = IntN - 1 To 0 Step -1
strMax = strA(0)
intM = 0
' poszukiwanie największej wartości w ciągu
For intK = 0 To intI
If strA(intK) > strMax Then
strMax = strA(intK)
intM = intK
End If
Next intK
strP = strA(intI)
strA(intI) = strMax
strA(intM) = strP
txtintA(intI) = strMax
txtintA(intM) = strP
Next intI
End Sub