getx function is used to get the current position of x coordinate on screen. We can set the current position of cursor by using moveto function.
General syntax for getx function is:
getx( );
#include <graphics.h>
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
char msg[50];
initgraph(&gd,&gm,"C:\\tc\\bgi");
moveto(200,160);
sprintf(msg,"Current position of X: %d",getx());
outtext(msg);
getch();
closegraph();
return 0;
}
General syntax for getx function is:
getx( );
C graphics program to demonstrate getx function.
#include <graphics.h>
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
char msg[50];
initgraph(&gd,&gm,"C:\\tc\\bgi");
moveto(200,160);
sprintf(msg,"Current position of X: %d",getx());
outtext(msg);
getch();
closegraph();
return 0;
}
Download |
---|
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.