program sinusoida; uses crt,graph; var x0,y0,c,driver,mode:integer; a,b,x,y,e,f,g,h:real; function def:real; var Xasp,Yasp:word; begin GetAspectRatio(Xasp,Yasp); def:=Xasp/Yasp end; begin ClrScr; write(' Unesite granice intervala (a,b):'); readln(a,b); write(' Odredite broj piksela za jedinicu u koordinatnom sistemu:'); readln(c); write(' Unesite parametre jednacine y=AsinB(Cx+D):'); readln(e,f,g,h); x0:=400; y0:=300; driver:=detect; initgraph(driver,mode,''); Line(0,y0,GetMaxX,y0); Line(x0,0,x0,GetMaxY); x:=a; while x<=b do begin y:=e*sin(f*(g*x+h)); y:=y*c*def; putpixel(x0+round(x*c),y0-round(y),15); x:=x+1/c end; readln; closegraph end. |
|