I need help changing the color of a certain cout statement. Here is the small code:
cout <<
"Input: ";cin >> insert;
cout << endl;
I need to change the text *input: * into a different collor.I hope you guys can help me out.
I need help changing the color of a certain cout statement. Here is the small code:
cout <<
"Input: ";cin >> insert;
cout << endl;
I need to change the text *input: * into a different collor.I hope you guys can help me out.
changing text color?
innocent
You could type: system("color 0a"); // you can replace the 0a with a different combo.
0a represents a black background with green text. Here is a table of alternate colors:
Letters are text while numbers are background.
Jeff Williams
utkuozan
HANDLE hdl = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(hdl, &info);
SetConsoleTextAttribute(hdl, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
cout << "Input: ";
SetConsoleTextAttribute(hdl, info.wAttributes);
The first call to SetConsoleTextAttribute() sets the color to yellow (red | green | bright). The second call restores it to what it was before.