Text background in C


Text background in C

We can change the background colour of the screen with the help of textbackground()
in-built function.

This function selects a new text background color.


Syntax :


textbackground(int color);

Parameter passed :

int color is passed as the parameter. This is the same as we pass in textcolor().

A scolors in c can be represented both by value and name, hence both of the below
are correct :

textbackground(BLUE);

textbackground(1);


Example :



#include <stdio.h>
#include <conio.h>

void main()
{
textbackgroundcolor(4);

clrscr(); //clrscr() should be after the textbackground() function

getch();
}

Output :


















     Prev                                                   NEXT

0 comments:

Post a Comment