gety() function in C
Last Updated :
25 Jan, 2018
The header file graphics.h contains gety() function which returns the Y coordinate of the current position.
Syntax :
int gety();
Example :
Explanation : Initially, the Y coordinate of the current position is 0. On moving the coordinates using moveto() function, the Y coordinate changes to 50.
Below is the implementation of gety() function:
#include <graphics.h>
#include <stdio.h>
int main()
{
int gd = DETECT, gm;
char arr[100];
initgraph(&gd, &gm, "" );
sprintf (arr, "Current position of y = %d" ,
gety());
outtext(arr);
moveto(80, 50);
sprintf (arr, "Current position of y = %d" ,
gety());
outtext(arr);
getch();
closegraph();
return 0;
}
|
Output :
Share your thoughts in the comments
Please Login to comment...