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

  1. #include<graphics.h>
  2. #include<conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.  
  8.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  9.  
  10.    moveto(100, 100);
  11.    lineto(200, 200);  
  12.    
  13.    getch();
  14.    closegraph();
  15.    return 0;
  16. }