#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <FileConstants.au3>
#include <GuiComboBox.au3>
Local $hGUI = GUICreate("Сортировка массива", 400, 400)
GUICtrlCreateLabel("Изначальный массив", 10,0,200,150)
Local $out1 = GUICtrlCreateLabel("", 10,50,200,150)
GUICtrlCreateLabel("Отсортированный массив", 10,100,200,150)
Local $out2 = GUICtrlCreateLabel("", 10,150,200,150)
Local $testsort = GUICtrlCreateButton("Сортировать массив", 200,250, 185, 50)
Local $sz = 4
Local $arr[5] = [1,2,3,5,4]
local $text1
for $i = 0 to $sz
$text1 &= $arr[$i]
next
GUICtrlSetData($out1,$text1)
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $testsort
for $i = 0 to $sz-1
for $j = 0 to $sz-$i-1
if $arr[$j] > $arr[$j+1] then
Local $n_1 = $arr[$j]
Local $n_2 = $arr[$j+1]
$arr[$j+1]= $n_1
$arr[$j]= $n_2
EndIf
Next
Next
local $text2
for $i = 0 to $sz
$text2 &= $arr[$i]
next
GUICtrlSetData($out2,$text2)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
|