Dim m(10)
Dim u As Integer
Private Sub Command1_Click()
Form1.ForeColor = vbRed
Form1.FontSize = 12
List1.Clear: List2.Clear
For i = 1 To 10
m(i) = Int(Rnd * 10) + 1
List1.AddItem m(i)
Next i
End Sub
Private Sub Command2_Click()
For i = 1 To 10
For j = 1 To 9
If m(j) > m(j + 1) Then
u = m(j)
m(j) = m(j + 1)
m(j + 1) = u
End If
Next j
Next i
For i = 1 To 10
List2.AddItem m(i)
Next i
End Sub
Module Module1
Sub Main()
Console.WriteLine("Введите восемь чисел")
'Массив для хранения восьми чисел
Dim nums(7) As Integer
For i As Integer = 0 To nums.Length - 1
Console.Write("{0}-е число: ", i + 1)
nums(i) = Int32.Parse(Console.ReadLine())
Next
'Алгоритм сортировки
Dim temp As Integer = nums(0)
For i As Integer = 0 To nums.Length - 1
For j As Integer = i + 1 To nums.Length - 1
If nums(i) > nums(j) Then
temp = nums(i)
nums(i) = nums(j)
nums(j) = temp
End If
Next
Next
'Выводим элементы массива
For Each i As Integer In nums
Console.Write("{0} ", i)
Next
Console.ReadLine()
End Sub
End Module