moveto function in c graphic

moveto function is use to move cursor position at particular position. It takes 2 arguments, both are int type. Which specify x and y coordinate on screen to put cursor.

General syntax of moveto function is 
moveto( int x-pos, int y-pos );

                                                            Moveto function is used with outtext function to display text or string at particular location on screen.


C Graphic program to demonstrate moveto function


#include <graphics.h>
#include <stdio.h>



int main( )
{
    int gd=DETECT, gm;
    char msg[]="Demonstration of moveto function";
    initgraph(&gd,&gm,"C:\\tc\\bgi");

    setbkcolor(8);

    moveto(200,140);
    outtext("Programmingcampus.com");
    moveto(200,170);
    outtext(msg);
    getch();
    closegraph();

    return 0;
}


moveto function of c graphics

Download


0 comments:

Post a Comment