You are here

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

  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(250, 250);
  11.    linerel(100, -100);
  12.  
  13.    getch();
  14.    closegraph();
  15.    return 0;
  16. }