In text mode, you can only output text in a
Anything text you place outside that screen is wrapped on the next line.
However, in graphics mode, you now have a
Any object that is outside that region is truncated or cut off.
To display any text, we can use the outtext() function.
We simply have to pass the string we want to display inside the function to display any text.
main () {
int gd = DETECT, gm;
initgraph(&gd, &gm, "C://TURBOC3//BGI");
outtext("Hello World!");
getch();
closegraph()
return 0;
}There is an another variant of this function, outtextxy().
Like the outtext() function, it also displays a text, but it also accepts coordinates where we want to display our text.
main () {
int gd = DETECT, gm;
initgraph(&gd, &gm, "C://TURBOC3//BGI");
outtextxy(320, 240, "Hello World!");
getch();
closegraph()
return 0;
}This would now output it around the center of the screen.