• Have Any Question?
  • contact@eitworld.com

Linerel() Function





linerel() function is used to draw line from current position to a point where we want to end the line that is at the relative distance from the c.p . This function is used with the moverel() function to draw the line.

Declaration

void linerel(int x, int y);
  • linerel() function contains two parameter. 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);

moverel(100,100);

linerel(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 moverel() function will move the current position with a relative distance to a position (100,100). Finally linerel() function will draw the line from current position to position at relative distance from current position that is (320,240).

Output

c graphics



Real Time Web Analytics