Program: rysujący twarz ludka.
Przy użyciu wcześniej zdefiniowanych w kodzie wartości – rysujących każdą figurę z osobna.
Kompilator: Turbo Pascal
Kod programu:
Program grafa;
uses crt,graph;
var driver,mode,cx,cy,i,r:integer;
begin
clrscr;
driver:=detect;
initgraph(driver,mode,'C:\Progra~1\TP\BGI');
cx:=getmaxx div 2;
cy:=getmaxy div 2;
setbkcolor(blue);
setfillstyle(1,yellow);
fillellipse(cx,cy,200,200);
setfillstyle(1,red);
fillellipse(cx,cy+80,150,80);
setfillstyle(1,yellow);
bar(cx-150,cy,cx+150,cy+75);
setfillstyle(1,white);
fillellipse(cx-70,cy-50,80,80);
fillellipse(cx+70,cy-50,80,80);
setfillstyle(1,black);
fillellipse(cx-70,cy-50,40,40);
fillellipse(cx+70,cy-50,40,40);
setfillstyle(1,white);
fillellipse(cx-55,cy-70,10,10);
fillellipse(cx+85,cy-70,10,10);
setfillstyle(1,green);
fillellipse(cx,cy-170,200,40);
fillellipse(cx+30,cy-200,30,30);
readkey;
cleardevice;
setbkcolor(black);
floodfill(15,15,red);
setfillstyle(1,yellow);
fillellipse(cx,cy,200,200);
setfillstyle(1,red);
setcolor(black);
fillellipse(cx,cy+80,150,80);
setfillstyle(1,black);
moveto(cx-30,cy+180);
lineto(cx+30,cy+180);
lineto(cx,cy+220);
lineto(cx-30,cy+180);
floodfill(cx,cy+190,black);
setfillstyle(1,yellow);
setcolor(yellow);
fillellipse(cx,cy+40,150,80);
setcolor(white);
setfillstyle(1,white);
fillellipse(cx-70,cy-50,80,80);
fillellipse(cx+70,cy-50,80,80);
setfillstyle(1,black);
fillellipse(cx-70,cy-50,40,40);
fillellipse(cx+70,cy-50,40,40);
setfillstyle(1,white);
fillellipse(cx-55,cy-70,10,10);
fillellipse(cx+85,cy-70,10,10);
setfillstyle(1,black);
setcolor(black);
moveto(cx+30,cy-180);
lineto(cx+100,cy-150);
lineto(cx+150,cy-200);
lineto(cx+30,cy-180);
floodfill(cx+75,cy-170,black);
moveto(cx-30,cy-180);
lineto(cx-100,cy-150);
lineto(cx-150,cy-200);
lineto(cx-30,cy-180);
floodfill(cx-75,cy-170,black);
moveto(cx+15,cy+50);
lineto(cx+15,cy+80);
lineto(cx+80,cy+100);
lineto(cx+15,cy+50);
floodfill(cx+16,cy+65,black);
moveto(cx-15,cy+50);
lineto(cx-15,cy+80);
lineto(cx-80,cy+100);
lineto(cx-15,cy+50);
floodfill(cx-16,cy+65,black);
randomize;
repeat
begin
r:=r+150;
sound(100+r);
delay(50);
end;
until keypressed;
nosound;
repeat until keypressed;
closegraph;
nosound;
end.