gety function is used to get the current position of y coordinate on screen. We can set the current position of cursor by using moveto function.
General syntax for gety function is:
gety( );
#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 Y: %d",gety());
outtext(msg);
getch();
closegraph();
return 0;
}
General syntax for gety function is:
gety( );
C graphics program to demonstrate gety 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 Y: %d",gety());
outtext(msg);
getch();
closegraph();
return 0;
}
Download |
---|
0 comments:
Post a Comment