You are here

Function moverel in C

Function moverel moves the current position to a relative distance.

Declaration: void moverel(int x, int y);

C programming code for moverel

#include <graphics.h>
#include <conio.h>

main()
{
   int gd = DETECT, gm, x, y;
   char message[100];

   initgraph(&gd, &gm, "C:\\TC\\BGI");

   moveto(100, 100);
   moverel(100, -100);

   x = getx();
   y = gety();

   sprintf(message, "Current x position = %d and y position = %d", x, y);
   outtextxy(10, 10, message);

   getch();
   closegraph();
   return 0;
}