You are here

lineto function in c

lineto function draws a line from current position(CP) to the point(x,y), you can get current position using getx and gety function.

C programming code for lineto

#include<graphics.h>
#include<conio.h>
 
main()
{
   int gd = DETECT, gm;
 
   initgraph(&gd, &gm, "C:\\TC\\BGI");
 
   moveto(100, 100);
   lineto(200, 200);   
 
   getch();
   closegraph();
   return 0;
}