Printing Text in Graphics Using Outtextxy Function
Program :
1 2 3 4 5 6 7 8 9 10 11 12 | #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(); } |
Explanation :
1 | outtextxy(x,y,"Hello World"); |
- This Function is Similar to Printf Statement.
- Printf Prints Text on Screen in “Text Mode” while outtextxy() function Prints Text onto Screen in “Graphics Mode“.
- This Function Accepts 3 Parameters.
Syntax :
1 | outtextxy(x,y,"Hello World"); |
Parameter | Explanation |
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 |