The header file graphics.h contains moveto() function which changes the current position to (x, y)
Syntax :
void moveto(int x, int y);
Examples :
Input : x = 70, y = 40
Output :
Input : x = 50, y = 80
Output :
Below is the implementation of moveto() function:
#include <graphics.h>
#include <stdio.h>
int main()
{
int gd = DETECT, gm;
char arr[100];
initgraph(&gd, &gm, "" );
sprintf (arr, "X = %d, Y = %d" , getx(),
gety());
outtext(arr);
moveto(70, 40);
sprintf (arr, "X = %d, Y = %d" , getx(),
gety());
outtext(arr);
getch();
closegraph();
return 0;
}
|
Output :