program OneRowTomultilycol;
{$APPTYPE CONSOLE}
uses
SysUtils;
procedure OneRowTomultilycol(m,n:Integer);
var Arr2:Array of array of Integer;
arr1:array of Integer;
I,J,Row,Col:integer;
tmp:integer;
begin
setlength(arr2,m);
for i:=low(arr2) to high(arr2) do
setlength(arr2[i],n);
//Init arr2
writeln('The arr2 value:');
for i:=0 to high(arr2) do
begin
for j:=0 to high(arr2[i]) do
begin
arr2[i,j]:=i*n+j;//i is index of row ,j is index of col,n is length of col
write(arr2[i,j]);
write(' ');
end;
writeln;
end;
//set arr1 and output arr1
setlength(arr1,m*n);
writeln('The arr1 value:');
for i:=0 to m*n-1 do
begin
Row:=i div n;
Col:=i mod n;
arr1[i]:=arr2[Row,Col];
writeln(arr1[i]);
end;
writeln('Please press <enter> exit...');
readln;
end;
begin
{ TODO -oUser -cConsole Main : Insert code here }
OneRowTomultilycol(2,2);
end.