#include #include #include #include void main() { struct point { int x,y; } p1, pbe; int lon,sho,Drive, Mode; float i, tx, ty, x, y, min, max; int j, wl, x1, y1; printf("give me the original point --> "); scanf("%d %d",&p1.x,&p1.y); printf("input the range min max --> "); scanf("%f %f",&min,&max); printf("give me the wave length --> "); scanf("%d",&wl); Drive=DETECT; initgraph(&Drive, &Mode, ""); setcolor(14); line(p1.x,0, p1.x,479); line(0,p1.y,639,p1.y); /* coordinate line */ for (j=0,i=min; i<=max; i+=0.05) { x=p1.x+i*wl; y=p1.y+wl*sin(i); x1=(int)x; y1=(int)y; if ((x1 >= 0) && (x1 <= 639) && (y1 >= 0) && (y1 <= 479)) { if (j == 0) { moveto(x1,y1); j=1; } else lineto(x1,y1); delay(300); } } getche(); closegraph(); }