Tuesday, 26 September 2017

how to generate colorful output in c language

To generate colorful output on console in c language we are going to use a predefined function of c language that is textcolor().

Now ,in this post we will learn how to use this textcolor funtion to generate colorful output on console.

declaration of textcolor -

void textcolor(int color);

here we have to send the integral value of the corresponding  color that we want to use .

Color Numerical Value
BLACK 0
BLUE 1
GREEN 2
CYAN 3
RED 4
MAGENTA 5
BROWN 6
LIGHTGRAY 7
DARKGRAY 8
LIGHTBLUE 9
LIGHTGREEN 10
LIGHTCYAN 11
LIGHTRED 12
LIGHTMAGENTA 13
YELLOW 14
WHITE 15

here are more colors than this. The colors available depend on the installed graphics drivers and current mode. Colors must be written in all Upper Case
because these colors are predefined macros.



                        note :we must use cpreintf function instead printf.

 #include<conio.h>  
 #include<stdio.h>  
 int main()  
 {  
         textcolor(RED);// the color is set to red  
         cprintf("I am Red");///the output will be in red color  
         textcolor(GREEN);// the color is set to green  
         cprintf("I am green");///the output will be in green color  
         textcolor(BLUE);// the color is set to blue  
         cprintf("I am blue");///the output will be in blue color  
         textcolor(CYAN);// the color is set to cyan  
         cprintf("I am Cyan");///the output will be in Cyan color  
         textcolor(YELLOW);// the color is set to yellow  
         cprintf("I am Yellow");///the output will be in yellow color  
        return 0;  
 }  

1 comment:

WhatsApp will give Rs 1.8 crores to new Indian startups, Here is all you need to know

The "Startup India WhatsApp Grand Challenge" has been appraise growth in the entrepreneurial sector. Total prize money of Rs 1.8...