Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++ coloring issue


ghost's Avatar
0 0

Yes, I know this is kinda "lol"-ish but I'd like to know if you can color the output text in C++, and how to do it. Ex.: for cout<<"Hello World!"; instead of it being gray or black, to be, let's say, green.

I tried with textcolor(0…14) but it didn't work. I tried on the DOS Borland C++.

Don't know why i'd use that, maybe just to show off. Anyway, this question was a friend of mine's and I'd like to know the answer.

Thanks, Wiz


ghost's Avatar
0 0

system("color 0a");

Where the first digit is the background and the second is the font color. (or vice versa maybe..)

open up a cmd window and type color /?

:)