I want to give better screen show. Therefore I want to know whether any formula/code do exit to depict color screen in c++.
There is no standard C/C++ library for that. What compiler are you using? What target are you developing for? console, gui?
QUOTE Sir, I use C++ compiler. I don't have any target for developing. Also I have no idea about gui(Graphic User Interface).UNQUOTE (b.n.rohit)
Hello, By compiler, I mean which company makes the one that you are using? Borland, Microsoft, etc. For example, Borland's older compilers like Turbo C, Borland CPP have the function textbackground. There's a bit of an issue when using older compilers in a Windows environment for stuff like getch, background color, etc... the "console" is in fact a window that emulates the old text mode. The program may have goofy behavior when non-standard functions are used. For more modern compilers, you'll probably need to use the API console functions throughout as cout, I think, will default to having gray text on a black background no matter how many times the background / foreground colors are changed. Maybe someone else knows for certain. Here's a crude attempt using API functions. Code: #include <iostream> #include <windows.h> int main() { TCHAR out_text[] = "Hello World!"; COORD init_coord = { 0 , 0 }, /* start at upper left corner */ place_at = { 40, 12 }; /* location to display out_text */ DWORD ret; CONSOLE_SCREEN_BUFFER_INFO cbuf; // console window paramters HANDLE hnd_out = GetStdHandle(STD_OUTPUT_HANDLE); // get handle for console output GetConsoleScreenBufferInfo(hnd_out, &cbuf); // call function to retrieve parameters // needed to "fill the screen" // blue background and yellow text FillConsoleOutputAttribute(hnd_out, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_BLUE, cbuf.dwSize.X * cbuf.dwSize.Y, init_coord, &ret); WriteConsoleOutputCharacter(hnd_out, out_text, sizeof out_text, place_at, &ret); return 0; } Hope that helps