getx

Overview :

The "getx" function is used to get the value of the current x co-ordinate in the current graphics mode and driver.

Syntax :
int getx();
Description :

The "getx" function has no parameters

  • The function can be called in grahics mode.

  • The function return the current value of the x co-ordinate



Example :
#include <stdio.h>
#include <conio.h>
#include <graphics.h>

int main()
{
    
   int gm,gd=DETECT,x;
   
   initgraph(&gd,&gm,"C:\\turboc3\\bgi");
   setcolor(10);
   
   x = getx();
   
   printf("\nThe current position is %d along x direction",x);
   
   moveto(100,100);
   
   x = getx();
   
   printf("\nNow the position is %d",x);
   
   getch();
   closegraph();
   return 0;
}

Comments

comments powered by Disqus