Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<graphics.h>
- #include<dos.h>
- #include<math.h>
- int main()
- {
- double x1,y1,temp,x2,y2,dx,dy,x,y,m,b,xf;
- int gd=DETECT, gm, color, angle=0;
- initgraph(&gd, &gm,"C:\\TC\\BGI\\");
- printf("Please enter the value of x1,y1,x2,y2");
- scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
- if(y1>y2)
- {
- temp=y1;
- y1=y2;
- y2=temp;
- }
- x=x1;
- y=y1;
- dx=fabs(x1-x2);
- dy=fabs(y1-y2);
- m=dy/dx;
- b=y-(m*x1);
- circle(x,y,1);
- while(y<y2)
- {
- y++;
- xf=(y-b)/m;
- x=floor(xf+.5);
- circle(x,y,1);
- delay(200);
- }
- getch();
- closegraph();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement