program jednakokrakitrokut;
uses crt,graph;
var driver,mode:integer;
a,b,xc,yc,h:real;
begin
ClrScr;
write(' Unesi duzine osnovice i kraka:');
readln(a,b);
driver:=detect;
initgraph(driver,mode,'');
h:=sqrt(b*b-a*a);
if (h>0) and (h<GetMaxY) and (2*b>=a)
then
begin
xc:=GetMaxX/2;
yc:=GetMaxY/2;
h:=sqrt(sqr(b)-sqr(a/2));
MoveTo(round(xc-a/2),round(yc+h/3));
LineRel(round(a),0);
LineRel(-round(a/2),-round(h));
LineRel(-round(a/2),round(h));
readln;
closegraph
end
else
begin
restorecrtmode;
writeln(' Date velicine ne mogu biti stranice trougla!');
readln
end
end.
|
 |