- Код: Выделить всё
Option Explicit
Private Sub Command1_Click()
Const N = 9
Dim A(1 To N) As Integer, i As Byte, j As Byte, s As Byte
Dim B(1 To N) As Byte, max As Long
For i = 1 To N
A(i) = InputBox("введите " & i & "-й элемент массива", "Заполнение массива")
lbl2.Caption = lbl2 & " " & A(i)
Next i
max = A(1)
s = 0
For i = 1 To N
If A(i) > max Then
max = A(i)
s = 0
End If
If A(i) = max Then
s = s + 1
B(s) = i
End If
Next i
For j = 1 To s
For i = B(s - j + 1) To N - 1
A(i) = A(i + 1)
A(i + 1) = max
Next i
Next j
lbl1.Caption = " "
For i = 1 To N
lbl1.Caption = lbl1 & " " & A(i)
Next i
End Sub
[Viper] :: Пользуемся тэгами CODE!