/* ------------------------------------ Modulul declaratiilor biblioteca ------------------------------------ */ #include #include #include int x_orig = 150; int y_orig = 200; int scalareX = 100; int scalareY = 100; int ax=1,ay=1; /* ------------------------------------ Modulul functii apel ------------------------------------ */ float f(float x) { float a=1.8,b=-1.3,c=-3.9,d=1.6,e=1.0,g=0,y; y=a*x*x*x*x*x+b*x*x*x*x+c*x*x*x+d*x*x+e*x+g; return y; } int tx(float x){ return ax*(x_orig + x*scalareX); } int ty(float y){ return ay*(400-y_orig - y*scalareY); } /* ------------------------------------ Modulul functie principala ------------------------------------ */ void main(void) { int gd=DETECT,gm,col=7,r=400; int maxX=640,minX=0,maxY=480,minY=0; float i,x,y,xx,yy,D=100,d=ay*D; clrscr(); initgraph(&gd,&gm,"c:\\borlandc\\bgi"); clrscr(); //Implicit LIGHTGRAY setcolor(RED); line(ax*minX,ay*(r-200),ax*maxX,ay*(r-200)); //Axa absciselor line(ax*150,ay*minY,ax*150,ay*maxY); //Axa ordonatelor circle(ax*150,ay*(r-200),2); //Punctul (0,0) circle(ax*50,ay*(r-200),2); //Punctul (-1,0) circle(ax*250,ay*(r-200),2); //Punctul (1,0) circle(ax*150,ay*(r-300),2); //Punctul (0,1) circle(ax*150,ay*(r-100),3); //Punctul (0,-1) setcolor(BLUE); /*i=-150; x=i/100; xx=150+100*x; y=f(x); yy=200-100*y; moveto(ax*xx,yy);*/ for(x=-2;x<=2;x=x+0.01) { putpixel(tx(x),ty(f(x)),BLUE); } getch(); closegraph(); printf("Am rev la mod text"); }