Sunday, November 25, 2012

PRINT A TEXT USING GRAPHIC FUNCTIONS


PRINT A TEXT USING GRAPHIC FUNCTIONS


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
            int gd=DETECT,gm,errorcode;
            int y=0,x=0;
            int i;
            char msg[80];
            initgraph(&gd,&gm,"");
            errorcode=graphresult();
            if(errorcode!=grOk)
            {
                        printf("Graphics error %s\n",grapherrormsg(errorcode));
                        printf("Press any key to halt");
                        getch();
                        exit(1);
            }

            for(i=1;i<=6;i++)
            {
                        settextstyle(TRIPLEX_FONT,HORIZ_DIR,i);
                        sprintf(msg,"Text");
                        outtextxy(x,y,msg);
                        y+=textheight(msg);
                        x+=textwidth(msg);
            }
            getch();
            closegraph();
}













OUTPUT:-


Text
       Text
            Text
               Text
                 Text
                Text
                   


0 comments:

Post a Comment