• Have Any Question?
  • contact@eitworld.com

Lineto() Function





lineto() function is used to draw the line from current position (c.p) to a specified position (). It collectively used with the moveto() function in order to draw the line on the screen.

Declaration

void lineto (int X, int Y);
  • lineto() function contains two parameters.
  • First parameter specifies the X-coordinate.
  • Second parameter specifies the Y-coordinate.
  • For better understanding go through the program:

Program

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd = DETECT, gm,x,y;

initgraph(&gd, &gm,” “);

moveto(20,30);

lineto(320,240);

getch();

closegraph();

}

Above program will draw the line from the current position to the specified position (320,240). In the above program moveto() function will move the current position to the new position (20,30) and lineto() function will draw the line from current position to position the (320,240).

Output

c graphics



Real Time Web Analytics