Text formatting
1. Text color()
2. Text background()
3. Cprintf()
4. Gotoxy()
1. textcolor()
Textcolor() is the function, used to set color into the output text.
Syntax:
Textcolor(<color_constant>);
[note: constants are always written in upper case(capital letter)]
Example
Textcolor(GREEN);
Cprintf(“trees!”);//this will be printed in green color.
Note: cprintf and printf are exactly same. Cprintf() can display/output the test in the color set by textcolor();
Text Effect (blink) can also be set using textcolor().
Textcolor(RED+BLINCK);
CPRINTF(“Attention!!”);
[onlu visible during full screen execution]
2. textbackground():
is the function used to set the background color of the output text.
Syntax:
textbackground(<color_constant>);
eg
textcolor(RED);
textbackground(YELLOW);
cprintf(“press any key to continue”);
textbackground(BLUE):
clrscr();
3. gotoxy()
gotoxy() is used to place the cursor in a specific place of the console.
Void main()
{
Textcolor(RED);
Cprintf(“student mgmt system!”);
Cprint(“\n Sibmitted byJ:
}
Syntax
gotoxy(x-coordinate,y-cordinate);
eg
gotoxy(10,10);
cprintf(“hellow”);
gotoxy(10,11);
cprintf(“__”);
No comments:
Post a Comment