//PascalABC.NET (версия 3.1, сборка 1196 от 09.03.2016) function Transpose(a: array[,] of integer): array[,] of integer; //Поворот на 90гр по часовой стрелке begin var m := Length(a, 0); var n := Length(a, 1); Result := new integer[n, m]; for var i := 0 to n-1 do begin for var j := 0 to m-1 do Result[i, j] := a[m-1-j, i]; end; end;
begin var n := ReadInteger('Введите n:'); //Заполнение матрицы NxN сл. числами и вывод на экран var a :=MatrixRandom(n, n); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(a[i,j]); println; end; println;
Println('поворот влево на 90 гр'); var b := Transpose(a); b:=Transpose(b); b:=Transpose(b); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(b[i,j]); println; end; println;
Println('поворот вправо на 90гр'); b := Transpose(a); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(b[i,j]); println; end; println;
Println('поворот на 180 гр'); b := Transpose(a); b := Transpose(b); for var i:=0 to n-1 do begin for var j:=0 to n-1 do Print(b[i,j]); println; end; end.
//Я просто опишу метод записи матрицы const n=100; var ar:array of array of integer; ars:array of array of string; i:integer;
procedure complection(var ar:array of array of integer;var ars:array of array of string); var i,j:integer; begin; for i:=1 to n do begin; for j:=1 to n do begin; ar[i,j]:=random(9); str(ar[i,j],ars[i,j]); end; end; end;
procedure burning(ars:array of array of string); var i,j:integer; t:text; begin; assign(t,'text.txt'); rewrite(t); for i:=1 to n do begin; writeln(t,' '); for j:=1 to n do write(t,ars[i,j],' '); end; end;
begin; randomize; setlength(ar,n+1); setlength(ars,n+1); for i:=1 to n do begin; setlength(ar[i],n+1); setlength(ars[i],n+1); end; complection(ar,ars); burning(ars); end.
function
Transpose(a: array[,] of integer): array[,] of integer;
//Поворот на 90гр по часовой стрелке
begin
var m := Length(a, 0);
var n := Length(a, 1);
Result := new integer[n, m];
for var i := 0 to n-1 do begin
for var j := 0 to m-1 do
Result[i, j] := a[m-1-j, i];
end;
end;
begin
var n := ReadInteger('Введите n:');
//Заполнение матрицы NxN сл. числами и вывод на экран
var a :=MatrixRandom(n, n);
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do
Print(a[i,j]);
println;
end;
println;
Println('поворот влево на 90 гр');
var b := Transpose(a);
b:=Transpose(b);
b:=Transpose(b);
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do
Print(b[i,j]);
println;
end;
println;
Println('поворот вправо на 90гр');
b := Transpose(a);
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do
Print(b[i,j]);
println;
end;
println;
Println('поворот на 180 гр');
b := Transpose(a);
b := Transpose(b);
for var i:=0 to n-1 do begin
for var j:=0 to n-1 do
Print(b[i,j]);
println;
end;
end.
const n=100;
var ar:array of array of integer;
ars:array of array of string;
i:integer;
procedure complection(var ar:array of array of integer;var ars:array of array of string);
var
i,j:integer;
begin;
for i:=1 to n do
begin;
for j:=1 to n do
begin;
ar[i,j]:=random(9);
str(ar[i,j],ars[i,j]);
end;
end;
end;
procedure burning(ars:array of array of string);
var
i,j:integer;
t:text;
begin;
assign(t,'text.txt');
rewrite(t);
for i:=1 to n do
begin;
writeln(t,' ');
for j:=1 to n do
write(t,ars[i,j],' ');
end;
end;
begin;
randomize;
setlength(ar,n+1);
setlength(ars,n+1);
for i:=1 to n do
begin;
setlength(ar[i],n+1);
setlength(ars[i],n+1);
end;
complection(ar,ars);
burning(ars);
end.