Трассировка на 3 StringGride не получается
вот код
Код
procedure TForm2.BitBtn2Click(Sender: TObject);
var i:integer;
begin
n:=strtoint(edit1.text);
randomize;
stringGrid1.colcount:=(strtoint(edit1.Text));
for i:=0 to n-1 do
begin
a[i]:=(random(20)-20)*2;
stringGrid1.Cells[i,0]:=inttostr(a[i]);
end;
end;
procedure TForm2.BitBtn3Click(Sender: TObject);
var i,j,z,k,t:integer;
begin
k:=0;
StringGrid2.ColCount:=(StrToInt(edit1.Text));
n:=StrToInt(edit1.Text);
StringGrid3.ColCount:=(StrToInt(edit1.Text));
for i:=0 to n-1 do
begin
for j:=0 to n-i do
begin
if a[j]>a[j+1] then
begin
t:=a[j];
a[j]:=a[j+1];
a[j+1]:=t;
end;
for z := 1 to n-1 do
stringgrid3.Cells[z-1,k]:=inttostr(a[z]);
k:=k+1;
end;end;
for i:=0 to n-1 do
for j:=0 to n-1 do
begin
StringGrid2.Cells[i,0]:=IntToStr(a[i]);
end;
end;
var i:integer;
begin
n:=strtoint(edit1.text);
randomize;
stringGrid1.colcount:=(strtoint(edit1.Text));
for i:=0 to n-1 do
begin
a[i]:=(random(20)-20)*2;
stringGrid1.Cells[i,0]:=inttostr(a[i]);
end;
end;
procedure TForm2.BitBtn3Click(Sender: TObject);
var i,j,z,k,t:integer;
begin
k:=0;
StringGrid2.ColCount:=(StrToInt(edit1.Text));
n:=StrToInt(edit1.Text);
StringGrid3.ColCount:=(StrToInt(edit1.Text));
for i:=0 to n-1 do
begin
for j:=0 to n-i do
begin
if a[j]>a[j+1] then
begin
t:=a[j];
a[j]:=a[j+1];
a[j+1]:=t;
end;
for z := 1 to n-1 do
stringgrid3.Cells[z-1,k]:=inttostr(a[z]);
k:=k+1;
end;end;
for i:=0 to n-1 do
for j:=0 to n-1 do
begin
StringGrid2.Cells[i,0]:=IntToStr(a[i]);
end;
end;