добрый день всем! нужно сделать так чтобы массив вводился в StringGrid1, а сортировался в StringGrid2!! у меня сразу сортирует в одном StringGrid1. помогите доделать!
Код:
procedure TForm1.Button2Click(Sender: TObject);
begin
Randomize;
for i:=0 to 36 do
mas[i]:=(10-Random(20));
for i:=0 to 36 do
If mas[i]<0 then mas[i]:=0;
for i:=1 to 36 do
begin
for j:=25 downto i do
if mas[j-1]>mas[j] then
begin
b:=mas[j-1];
mas[j-1]:=mas[j];
mas[j]:=b;
end;
end;
for i:=0 to 36 do
s:=0;
for i:=StringGrid1.RowCount-1 downto 0 do
if i mod 2=0
then
for j:=0 to StringGrid1.ColCount-1 do
begin
StringGrid1.Cells[j,i]:=IntToStr(mas[s]);
s:=s+1;
end
else begin
for k:=StringGrid1.RowCount-1 downto 0 do
if i mod 2=1
then
begin
StringGrid1.Cells[k,i]:=IntToStr(mas[s]);
s:=s+1;
end;
end;
end;