SHARE
TWEET

Untitled

a guest Oct 21st, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<graphics.h>
  4. #include<dos.h>
  5. #include<math.h>
  6.  
  7. int main()
  8. {
  9.     double x1,y1,temp,x2,y2,dx,dy,x,y,m,b,xf;
  10.     int gd=DETECT, gm, color, angle=0;
  11.     initgraph(&gd, &gm,"C:\\TC\\BGI\\");
  12.     printf("Please enter the value of x1,y1,x2,y2");
  13.     scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
  14.     if(y1>y2)
  15.     {
  16.         temp=y1;
  17.         y1=y2;
  18.         y2=temp;
  19.     }
  20.     x=x1;
  21.     y=y1;
  22.     dx=fabs(x1-x2);
  23.     dy=fabs(y1-y2);
  24.     m=dy/dx;
  25.     b=y-(m*x1);
  26.     circle(x,y,1);
  27.     while(y<y2)
  28.     {
  29.         y++;
  30.         xf=(y-b)/m;
  31.         x=floor(xf+.5);
  32.         circle(x,y,1);
  33.         delay(200);
  34.     }
  35.     getch();
  36.     closegraph();
  37.     return 0;
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top