Графічні оператори

Графічні оператори

Взірці розв'язування стандартних задач

program rushnik;

uses graph;

var Gd,Gm,i,a,c: integer;

Begin

Gd:=Vga; Gm:=Vgahi; initgraph (gd,gm,'');

for i:=-100 to 640 do

begin

setcolor (5); circle(i*10,300,100);

setcolor (2); circle(i*10,320,100);

setcolor (4); circle(i*10,340,100);

end;

{closegraph;}

readln; end.

program kolo;

uses graph,crt;

var Gd,Gm,r,c: integer;

Begin

Gd:=Vga; Gm:=Vgahi; initgraph (gd,gm,'');

repeat

r:=random (250); c:=random(16);

setcolor (c); circle(300,240,r);

until keypressed;

readln; end.

program sun;

uses graph,crt;

var Gd,Gm,x1,y1,x2,y2,c: integer;

Begin

Gd:=Vga; Gm:=Vgahi; initgraph (gd,gm,'');

setcolor (14); circle(300,240,50);

setfillstyle(1,14); floodfill(300,240,14);

repeat

x1:=random (600); y1:=random (480);

randomize; line(300,240,x1,y1);

until keypressed;

closegraph;

readln; end.

program lines;

uses graph,crt;

var Gd,Gm,x1,y1,x2,y2,c: integer;

Begin

Gd:=Vga; Gm:=Vgahi;

initgraph (gd,gm,'');

repeat

x1:=random (600); y1:=random (480);

randomize;

x2:=random (600); y2:=random (480);

c:=random(16);

setcolor (c);

line(x1,y1,x2,y2);

until keypressed; { повторюй, поки не натиснеш }

{closegraph;}

readln;

end.

program lines_2;

uses graph,crt;

var Gd,Gm,x1,y1,x2,y2,c: integer;

Begin

Gd:=Vga; Gm:=Vgahi; initgraph (gd,gm,'');

repeat

x1:=random (600); y1:=random (480);

randomize;

x2:=random (600); y2:=random (480);

c:=random(16);

setcolor (c);

line(x1,y1,x2,y2);

delay(10000); { це - пауза}

setcolor (0);

line(x1,y1,x2,y2);

until keypressed;

{closegraph;}

readln;

end.

Тести