Printing Text in Graphics Using Outtextxy Function

Printing Text in Graphics Using Outtextxy Function.

It is similar to printf statement.

Prints text on a screen in Text Mode while outtextxy( ) function prints Text onto screen in Graphics Mode

                  outtextxy(x,y,"Hello World");
This function accepts 3 parameters.

X Co-ordinate - Specifies X Co-ordinate.

Y Co-ordinate - Specifies Y Co-ordinate.

Text - String/Text to be printed on the specified Co-ordinates.


--------------------------------------------------------------------------------------------------------------------------

#include<graphics.h>
#include<stdio.h>
int main(void)
{
   int gdriver = DETECT, gmode;
   int x = 200, y = 200;
   initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
   outtextxy(x,y,"Hello World");
   closegraph( );
}

--------------------------------------------------------------------------------------------------------------------------

Output

--------------------------------------------------------------------------------------------------------------------------

Hello World



EmoticonEmoticon