Program PRACT16; Uses CRT; Const SIZE = 7; Var NAPR, n, i, j, x_b,y_b, x_e,y_e: Integer; a: Array [1..SIZE,1..SIZE] of integer;
Procedure PrintMassive; Var i,j: Byte; Begin ClrScr; For i := 1 to SIZE do Begin For j := 1 to SIZE do Begin GoToXY(i*4, j*3); write(a[j,i]); End; Writeln; End; ReadKey; End;
Begin ClrScr; x_e:=SIZE; y_e:=SIZE; n := 1; x_b := 1; y_b := 2; While (n <= SIZE * SIZE) do begin for i:=x_b to x_e do begin a[x_b,i] := n; inc(n); end; dec(x_e); for i:=y_b to y_e do begin a[i,y_e] := n; inc(n); end; for i:=x_e downto x_b do begin a[y_e,i] := n; inc(n); end; dec(y_e); for i:=y_e downto y_b do begin a[i,x_b] := n; inc(n); end; inc(x_b); inc(y_b); end; PrintMassive; end.
Источник:
Категория: Матрицы | Добавил: Seqular (24.09.2007)
| Автор: Дмитрий