VOOZH about

URL: https://www.geeksforgeeks.org/c/lineto-function-c/

⇱ lineto() function in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

lineto() function in C

Last Updated : 4 Dec, 2019
The header file graphics.h contains lineto() function which draws a line from current position to the point(x,y). Note : Use getx() and gety() to get the current position. Syntax :
lineto(int x, int y);

where,
(x, y) are the coordinates upto which the
line will be drawn from previous point.
CASE 1 : When the initial position of point is (0,0) Below is the implementation of lineto() function with initial position at origin : Output :
👁 Image
CASE 2 : When the initial position of point is not (0, 0) Below is the implementation of lineto() function with initial position other than origin :
Output :
👁 Image
Comment