
18.04.2013, 20:36
|
 |
Гуру
|
|
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,723
Репутация: 52347
|
|
Вот ведь, прямо искритесь от соприкосновения в теме 
Вот собственно весь код:
Код:
procedure TForm1.Button1Click(Sender: TObject);
Var
Row,Col: Integer;
begin
for Row := 0 to StringGrid1.RowCount - 1
do for Col := 0 to StringGrid1.ColCount - 1
do StringGrid1.Cells[Col, Row] := IntToStr(Random(100));
end;
procedure TForm1.Button2Click(Sender: TObject);
Var
i,j: Integer;
v: String;
begin
for i := 0 to StringGrid1.RowCount - 1
do for j := 0 to StringGrid1.RowCount - 2
do if StrToInt(StringGrid1.Cells[j, j]) < StrToInt(StringGrid1.Cells[j+1, j+1])
then begin
v := StringGrid1.Cells[j, j];
StringGrid1.Cells[j, j] := StringGrid1.Cells[j+1, j+1];
StringGrid1.Cells[j+1, j+1] := v;
end;
end;
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.
|