program kvadratnafunkcija;
uses crt,graph;
var  driver,mode,xc,yc,i,k,l:integer;
     a,b,c,y,x:real;
function def:real;
  var Xasp,Yasp:word;
  begin
    GetAspectRatio(Xasp,Yasp);
    def:=Xasp/Yasp;
  end;
begin
  ClrScr;
  writeln(' Ovaj program crta grafik kvadratne funkcije (y=A*(x^2)+B*x+C)');
  writeln;
  write(' Unesi koeficijente parabole (A,B,C):');
  readln(a,b,c);
  driver:=detect;
  initgraph(driver,mode,'');
  xc:=(GetMaxX+1) div 2;
  yc:=(GetMaxY+1) div 2;
  setbkcolor(black);
  setcolor(white);
  line(xc,0,xc,GetMaxY);
  line(0,yc,GetMaxX,yc);
  for i:=-(xc div 10) to (xc div 10) do
    begin
      moveto(xc+10*i,yc);
      linerel(0,round(-3));
      moveto(xc,yc-round(10*i));
      linerel(3,0)
    end;
  x:=-xc div 10;
  y:=a*sqr(x)+b*x+c;
  k:=round(xc+10*x);
  l:=round(yc-10*y*def);
  moveto(k,l);
  for i:=2*(-xc div 10) to 2*(xc div 10) do
    begin
      x:=0.5*i;
      y:=a*x*x+b*x+c;
      k:=round(xc+10*x);
      l:=round(yc-10*y*def);
      lineto(k,l)
    end;
  readln;
  closegraph
end.