outtext is the function used to display the given string on graphics mode at current position . outtext function takes only one argument that is char *string type.
To change the position of text or string we need to use moveto function. outtext function display string in its default text style. To change font style we need to use settextstyle function before the outtext function.
General syntax of outtext function is :
#include <graphics.h>
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
char msg[]="Demonstration of outtext function";
initgraph(&gd,&gm,"C:\\tc\\bgi");
setbkcolor(8);
moveto(200,140);
outtext("Programmingcampus.com");
moveto(200,170);
outtext(msg);
getch();
closegraph();
return 0;
}
To change the position of text or string we need to use moveto function. outtext function display string in its default text style. To change font style we need to use settextstyle function before the outtext function.
General syntax of outtext function is :
outtext( char *string);
C graphics program to demonstrate outtext function.
#include <graphics.h>
#include <stdio.h>
int main( )
{
int gd=DETECT, gm;
char msg[]="Demonstration of outtext function";
initgraph(&gd,&gm,"C:\\tc\\bgi");
setbkcolor(8);
moveto(200,140);
outtext("Programmingcampus.com");
moveto(200,170);
outtext(msg);
getch();
closegraph();
return 0;
}
Download |
---|
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.