program eksponencijalna; uses crt,graph; var driver,mode,xc,yc,i,k,l:integer; y,x:real; begin ClrScr; writeln(' Ovaj program crta grafik eksponencijalne funkcije y=e^x'); write(' (pritisni <enter> za nastavak)',exp(0)); readln; 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); x:=-xc*1.00; y:=exp(x); k:=round(xc+x); l:=round(yc-y); MoveTo(k,l); for i:=-xc to xc do begin x:=i*0.01; y:=exp(x); k:=xc+round(x*100); l:=yc-round(y*100); LineTo(k,l); end; readln; closegraph end. |
|