Hi, I'm using microsoft visual c++ and I was wonderig if anyone knows how to change the color of individual characters in an array .... if anyone can help, great!!!!!
This is a discussion on color within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm using microsoft visual c++ and I was wonderig if anyone knows how to change the color of individual ...
Hi, I'm using microsoft visual c++ and I was wonderig if anyone knows how to change the color of individual characters in an array .... if anyone can help, great!!!!!
Yes there is let me see if i can dig out an old program i have around here somewhere...
Well first off you need to include windows.h in the includes (where else would you put them? lol)
Well i cant find my files but here is a link...
http://www.codeproject.com/cpp/cppfo...#cons_txtcolor
After doing some Google searches it has kinda come back to me a little bit. Try this and just mess around with stuff til you figure it out
You can also try this:Code:#include <iostream> #include <windows.h> using namespace std; int main() { //setup some stuff HANDLE hConsole; hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, FOREGROUND_RED); cout<<"Red\n"; SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE); cout<<"Blue\n"; SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN); cout<<"Green\n"; SetConsoleTextAttribute(hConsole, 15); cout<<"There are a ton of ways to manipulate colors, give em a try!\n\n"; cin.get(); }
Have fun!Code:#include <iostream> #include <windows.h> using namespace std; int main() { HANDLE hConsole; hConsole = GetStdHandle(STD_OUTPUT_HANDLE); for(int i=0; i<255; i++) { SetConsoleTextAttribute(hConsole, i); cout<<"There are a ton of different combinations!!!\n"; } cin.get(); }