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

  1. #include <graphics.h>
  2. #include <conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm, x, y;
  7.    char message[100];
  8.  
  9.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  10.  
  11.    moveto(100, 100);
  12.    moverel(100, -100);
  13.  
  14.    x = getx();
  15.    y = gety();
  16.  
  17.    sprintf(message, "Current x position = %d and y position = %d", x, y);
  18.    outtextxy(10, 10, message);
  19.  
  20.    getch();
  21.    closegraph();
  22.    return 0;
  23. }