Program drawFigure; uses graph; var gD,gR:integer; procedure drawHouse(x,y:word); const wallSide=70; windowSide=20; var houseRoof:array[1..4] of pointtype; begin setFillStyle(1,10); bar(x,y-wallSide,x+wallSide,y); rectangle(x,y-wallSide,x+wallSide,y); setFillStyle(1,1); bar(x+wallSide div 2-windowSide div 2,y-wallSide+wallSide div 2-windowSide div 2, x+wallSide div 2-windowSide div 2+windowSide,y-wallSide+wallSide div 2-windowSide div 2+windowSide); rectangle(x+wallSide div 2-windowSide div 2,y-wallSide+wallSide div 2-windowSide div 2, x+wallSide div 2-windowSide div 2+windowSide,y-wallSide+wallSide div 2-windowSide div 2+windowSide); setFillStyle(1,2); houseRoof[1].x:=x; houseRoof[1].y:=y-wallSide; houseRoof[2].x:=x+wallSide; houseRoof[2].y:=y-wallSide; houseRoof[3].x:=x+wallSide div 2; houseRoof[3].y:=y-wallSide-wallSide div 2; houseRoof[4].x:=x; houseRoof[4].y:=y-wallSide; fillPoly(4,houseRoof); end; procedure drawTree(x,y:word); const treeFH=90; treeFW=8; var ci:byte; branchFH,branchFW:byte; begin setFillStyle(1,6); bar(x,y-treeFH,x+treeFW,y); for ci:=1 to 6 do begin branchFH:=random(5)+1; branchFW:=random(8)+10; bar(x-branchFW,y-treeFH+ci*10,x,y-treeFH+ci*10+branchFH); bar(x+treeFW,y-treeFH+ci*10,x+treeFW+branchFW,y-treeFH+ci*10+branchFH); end; end; begin randomize; initgraph(gD,gR,''); drawHouse(100,280); drawHouse(230,270); drawHouse(430,290); drawHouse(330,180); drawTree(195,278); drawTree(325,275); drawTree(265,350); drawTree(360,290); drawTree(400,240); drawTree(580,285); drawTree(110,370); readln; closeGraph; end.
uses graph;
var
gD,gR:integer;
procedure drawHouse(x,y:word);
const
wallSide=70;
windowSide=20;
var
houseRoof:array[1..4] of pointtype;
begin
setFillStyle(1,10);
bar(x,y-wallSide,x+wallSide,y); rectangle(x,y-wallSide,x+wallSide,y);
setFillStyle(1,1);
bar(x+wallSide div 2-windowSide div 2,y-wallSide+wallSide div 2-windowSide div 2, x+wallSide div 2-windowSide div 2+windowSide,y-wallSide+wallSide div 2-windowSide div 2+windowSide); rectangle(x+wallSide div 2-windowSide div 2,y-wallSide+wallSide div 2-windowSide div 2, x+wallSide div 2-windowSide div 2+windowSide,y-wallSide+wallSide div 2-windowSide div 2+windowSide);
setFillStyle(1,2);
houseRoof[1].x:=x; houseRoof[1].y:=y-wallSide; houseRoof[2].x:=x+wallSide;
houseRoof[2].y:=y-wallSide;
houseRoof[3].x:=x+wallSide div 2; houseRoof[3].y:=y-wallSide-wallSide div 2;
houseRoof[4].x:=x; houseRoof[4].y:=y-wallSide;
fillPoly(4,houseRoof);
end;
procedure drawTree(x,y:word);
const
treeFH=90;
treeFW=8;
var
ci:byte;
branchFH,branchFW:byte;
begin
setFillStyle(1,6);
bar(x,y-treeFH,x+treeFW,y);
for ci:=1 to 6 do
begin
branchFH:=random(5)+1; branchFW:=random(8)+10;
bar(x-branchFW,y-treeFH+ci*10,x,y-treeFH+ci*10+branchFH);
bar(x+treeFW,y-treeFH+ci*10,x+treeFW+branchFW,y-treeFH+ci*10+branchFH);
end;
end;
begin
randomize;
initgraph(gD,gR,'');
drawHouse(100,280); drawHouse(230,270); drawHouse(430,290); drawHouse(330,180);
drawTree(195,278); drawTree(325,275); drawTree(265,350); drawTree(360,290); drawTree(400,240); drawTree(580,285); drawTree(110,370);
readln; closeGraph;
end.