Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program ninetyDEGREEEEEEEEEEEE;
- uses WinCrt;
- type
- mat= Array [1..100,1..100] of Integer;
- var
- m : mat ;
- n : byte;
- Procedure aff(m : mat ; n : Byte);
- var
- a,b: Byte;
- begin
- for a:=1 to n do
- begin
- for b:=1 to n do
- write(m[a,b]:5);
- writeln;
- end;
- end;
- Procedure rempt(var m : mat ; n: Byte );
- var
- e: LongInt;
- a,b: Byte;
- ch: String;
- begin
- ch:='1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,' ;
- for a:=1 to n do
- for b:=1 to n do
- begin
- val(copy(ch,1,pos(',',ch)-1),m[a,b],e);
- delete(ch,1,pos(',',ch));
- end;
- end;
- Procedure rotate( var m : mat ; n : Byte);
- var
- x,y,z,xy,l,c,a: Byte;
- vf: Boolean;
- begin
- x:=1;
- y:=0;
- vf:=False;
- while (vf= false)do
- begin
- y:=y+1;
- if y=n-x+1 then
- begin
- // writeln('""""',x,y:4);
- x:=x+1;
- y:=x;
- end;
- z:=m[x,y];
- for a:=1 to 4 do
- begin
- l:=y;
- c:=x;
- c:= n - (c-1);
- xy:=m[l,c];
- m[l,c]:=z;
- z:=xy;
- //writeln(m[x,y],' [',x,',',y,']----->[',l,',',c,']',m[l,c]:2);
- x:=l;
- y:=c;
- end;
- //write('a',x,y:2);
- if n mod 2 = 0 then
- vf:= x = n div 2
- Else
- vf:= x = n div 2 +1;
- end;
- End;
- Procedure saisi(var n:Byte);
- begin
- repeat
- ClrScr;
- Write('N= ');
- readln(n);
- until n in [2..7];
- end;
- begin
- saisi(n);
- rempt(m,n);
- aff(m,n);
- rotate(m,n);
- writeln;
- aff(m,n);
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement