Даны целые положительные числа M и N. Сформировать целочисленную матрицу размера M × N, у которой все элементы I-й строки имеют значение 10·I (I = 1, …, M).
на форме два StringGrid-а, 3 Edit-а и 2 кнопки. Не знаю, что делать со второй частью, какое условие поставить?
PHP код:
var
Form1: TForm1;
a:array [1..100,1..100]of integer;
b:array[1..100,1..100] of integer;
i,j,j3,n,m,v:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
n:=strtoint(edit1.text);
m:=strtoint(edit2.text);
stringgrid1.RowCount:=n;
stringgrid1.ColCount:=m;
for i:=0 to n-1 do
for j:=0 to m-1 do
begin
a[i,j]:=RandomRange(0, 60);
StringGrid1.Cells[j,i]:=IntToStr(a[i,j]);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
n:=strtoint(edit1.text);
m:=strtoint(edit2.text);
j:=1;
v:=strtoint(edit3.text);
stringgrid2.RowCount:=n;
stringgrid2.ColCount:=m;
for i:=0 to n-1 do
for j:=0 to m-1 do
if i=v then
begin
a[i-1,j]:=b[(i-1),j]*10 ;
StringGrid2.Cells[j,i]:=IntToStr(a[i,j]);
end;
end;
end.