program pattern; uses dos, crt, graph, printer; var gs, gm : integer; var xstart, ystart, rep, x, y, d, i, j :integer; arti : array [1..24] of integer;
procedure articiz (x,y,d: word); begin
arti[1]:=x; {x1} arti[2]:=y; {y1}
arti[3]:=x+d; {2} arti[4]:=y;
arti[5]:=x+d; {3} arti[6]:=y-d;
arti[7]:=x+2*d; {4} arti[8]:=y-d;
arti[9]:=x+2*d; {5} arti[10]:=y;
arti[11]:=x+3*d; {6} arti[12]:=y;
arti[13]:=x+3*d; {7} arti[14]:=y+d;
arti[15]:=x+2*d; {8} arti[16]:=y+d;
arti[17]:=x+2*d; {9} arti[18]:=y+2*d;
arti[19]:=x+d; {10} arti[20]:=y+2*d;
arti[21]:=x+d; {11} arti[22]:=y+d;
arti[23]:=x; {12} arti[24]:=y+d;
fillpoly (12, arti); {12 koseli ve arti dizinini kullanir} end;
begin gs:=detect; initgraph (gs,gm,'c:\progra~1\tp\bgi'); if graphresult <> grok then halt (1); cleardevice;
setfillstyle (1,4);
xstart := 10; {baslangic x degeri} ystart := -180; {baslangic y degeri} rep := 40; {tekrar sayisi}
x := xstart; y := ystart; d := 15;
for i:=1 to rep do begin for j:=0 to rep do begin x := x+d*i*3; y := y+d*i;
articiz (x,y,d);
x := xstart-d*j; y := ystart+3*d*j; end; end; readln; closegraph;
program pattern; uses dos, crt, graph, printer; var gs, gm: integer; var i, j : integer; var rx, ry : integer;
begin gs:=detect; initgraph (gs,gm,'c:\tp\bgi'); if graphresult <> grok then halt (1); cleardevice;
setcolor (0); rx := getmaxx div 8; ry := getmaxy div 8;
for i:= 0 to 1 do {en alttaki beyazlar} begin for j := 0 to 2 do begin fillellipse (2*rx+(rx*4*i),4*ry*j,rx,ry); fillellipse (j*4*rx,2*ry+(i*4*ry),rx,ry); end; end;
for i:= 0 to 3 do {ustteki beyazlar} begin for j:= 0 to 3 do begin fillellipse (rx+(i*2*rx),ry+(j*2*ry),rx,ry); end; end;
PROGRAM NESTED;
YanıtlaSilUSES CRT, DOS, GRAPH, PRINTER;
VAR GRAFIKSURUCU, GRAFIKKONUMU,i,j,L,K:INTEGER;
ARTI: ARRAY[1..24] OF INTEGER;
PROCEDURE ARTICIZ (X,Y,L,K: WORD);
BEGIN
ARTI[1]:=X;{X1}
ARTI[2]:=Y;{Y1}
ARTI[3]:=X+L; {X2}
ARTI[4]:=Y; {Y2}
ARTI[5]:=X+L; {X3}
ARTI[6]:=Y-L; {Y3}
ARTI[7]:= X+L+K; {X4}
ARTI[8]:= ARTI[6]; {Y4}
ARTI[9]:= ARTI[7]; {X5}
ARTI[10]:=Y;
ARTI[11]:=X+L+K+L;
ARTI[12]:=Y;
ARTI[13]:=X+L+K+L;
ARTI[14]:=Y+K;
ARTI[15]:=ARTI[9];
ARTI[16]:= Y+K;
ARTI[17]:= ARTI[9];
ARTI[18]:= Y+K+L;
ARTI[19]:= X+L;
ARTI[20]:= Y+L+K;
ARTI[21]:= X+L;
ARTI[22]:= Y+K;
ARTI[23]:= X;
ARTI[24]:= Y+K;
FILLPOLY(12,ARTI);
END;
BEGIN
GRAFIKSURUCU:=DETECT;
INITGRAPH (GRAFIKSURUCU, GRAFIKKONUMU,'C:\PROGRA~1\TP\BGI');
IF GRAPHRESULT<>GROK THEN HALT(1);
CLEARDEVICE;
SETFILLSTYLE (j-3,12-i);
L:=10;
K:=20 ;
FOR i := 1 TO 10 DO
FOR j := 1 TO 10 DO
BEGIN
ARTICIZ(100+(i-1)*(L+K+L),50+(J-1)*(L+K+L),L-i,K-j);
END;
READLN;
CLOSEGRAPH;
END.
Bu yorum yazar tarafından silindi.
YanıtlaSil{ornek a icin tek procedure kullanarak}
YanıtlaSilprogram pattern;
uses dos, crt, graph, printer;
var gs, gm : integer;
var xstart, ystart, rep, x, y, d, i, j :integer;
arti : array [1..24] of integer;
procedure articiz (x,y,d: word);
begin
arti[1]:=x; {x1}
arti[2]:=y; {y1}
arti[3]:=x+d; {2}
arti[4]:=y;
arti[5]:=x+d; {3}
arti[6]:=y-d;
arti[7]:=x+2*d; {4}
arti[8]:=y-d;
arti[9]:=x+2*d; {5}
arti[10]:=y;
arti[11]:=x+3*d; {6}
arti[12]:=y;
arti[13]:=x+3*d; {7}
arti[14]:=y+d;
arti[15]:=x+2*d; {8}
arti[16]:=y+d;
arti[17]:=x+2*d; {9}
arti[18]:=y+2*d;
arti[19]:=x+d; {10}
arti[20]:=y+2*d;
arti[21]:=x+d; {11}
arti[22]:=y+d;
arti[23]:=x; {12}
arti[24]:=y+d;
fillpoly (12, arti); {12 koseli ve arti dizinini kullanir}
end;
begin
gs:=detect;
initgraph (gs,gm,'c:\progra~1\tp\bgi');
if graphresult <> grok then halt (1);
cleardevice;
setfillstyle (1,4);
xstart := 10; {baslangic x degeri}
ystart := -180; {baslangic y degeri}
rep := 40; {tekrar sayisi}
x := xstart;
y := ystart;
d := 15;
for i:=1 to rep do
begin
for j:=0 to rep do
begin
x := x+d*i*3;
y := y+d*i;
articiz (x,y,d);
x := xstart-d*j;
y := ystart+3*d*j;
end;
end;
readln;
closegraph;
end.
{örnek b için}
YanıtlaSilprogram pattern;
uses dos, crt, graph, printer;
var gs, gm: integer;
var i, j : integer;
begin
gs:=detect;
initgraph (gs,gm,'c:\tp\bgi');
if graphresult <> grok then halt (1);
cleardevice;
setcolor (0);
for i:= 1 to 3 do {en alttaki beyazlar}
begin
fillellipse (100*i,100*i,50,50);
fillellipse (400-100*i,100*i,50,50);
end;
for i:= 0 to 3 do {ustteki beyazlar}
begin
for j:= 0 to 3 do
begin
fillellipse (50+100*i,50+100*j,50,50);
end;
end;
for i:= 0 to 4 do {en ustteki cemberler}
begin
for j:= 0 to 4 do
begin
circle (100*i,100*j,50);
end;
end;
readln;
closegraph;
end.
{örnek c için tam ekranda}
YanıtlaSilprogram pattern;
uses dos, crt, graph, printer;
var gs, gm: integer;
var i, j : integer;
var rx, ry : integer;
begin
gs:=detect;
initgraph (gs,gm,'c:\tp\bgi');
if graphresult <> grok then halt (1);
cleardevice;
setcolor (0);
rx := getmaxx div 8;
ry := getmaxy div 8;
for i:= 0 to 1 do {en alttaki beyazlar}
begin
for j := 0 to 2 do
begin
fillellipse (2*rx+(rx*4*i),4*ry*j,rx,ry);
fillellipse (j*4*rx,2*ry+(i*4*ry),rx,ry);
end;
end;
for i:= 0 to 3 do {ustteki beyazlar}
begin
for j:= 0 to 3 do
begin
fillellipse (rx+(i*2*rx),ry+(j*2*ry),rx,ry);
end;
end;
readln;
closegraph;
end.