implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
const
SIZE = 10;
var
a: array [1 .. SIZE] of integer;
min: integer;
j: integer;
buf: integer;
i, k: integer;
begin
for i := 1 to SIZE do
a[i] := StrToInt(StringGrid1.Cells[i - 1, 0]);
label2.caption := '';
for i := 1 to SIZE - 1 do
begin
min := i;
for j := i + 1 to SIZE do
if a[j] < a[min] then
min := j;
buf := a[i];
a[i] := a[min];
a[min] := buf;
{ }
for k := 1 to SIZE do
label2.caption := label2.caption + ' ' + IntTostr(a[k]);
label2.caption := label2.caption + #13;
end;
label2.caption := label2.caption + #13;
end;
end.