You are here

moveto function in c

moveto function changes the current position (CP) to (x, y)

Declaration: void moveto(int x, int y);

C programming code for moveto

  1. #include <graphics.h>
  2. #include <conio.h>
  3.  
  4. main()
  5. {
  6.    int gd = DETECT, gm;
  7.    char msg[100];
  8.  
  9.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  10.  
  11.    sprintf(msg, "X = %d, Y = %d",getx(),gety());
  12.  
  13.    outtext(msg);
  14.  
  15.    moveto(50, 50);
  16.  
  17.    sprintf(msg, "X = %d, Y = %d", getx(), gety());
  18.  
  19.    outtext(msg);
  20.  
  21.    getch();
  22.    closegraph();
  23.    return 0;
  24. }