Saturday, April 6, 2013

linerel function in c

Linerel function draws a line from the current position(CP) to a point that is a relative distance (x, y) from the CP, then advances the CP by (x, y). You can use getx and gety to find the current position.

C programming code for linerel

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

No comments:

Post a Comment