CAN ANYONE TELL ME HOW I ADD COLOR IN A PROGRAM???
LIKE THIS =D
CAN ANYONE TELL ME HOW I ADD COLOR IN A PROGRAM???
LIKE THIS =D
http://img76.imageshack.us/img76/1808/expl7pb.png
AN EXPLOSION DOESNT HAPPEN CUZ GOD WANTS, IT HAPPENS WHEN A SOMETHING "EXPLODES
Include windows.h and call this function:
More info on it here.Code:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED);
Is it really necessary to write in all caps?
Trinity: "Neo... nobody has ever done this before."
Neo: "That's why it's going to work."
c9915ec6c1f3b876ddf38514adbb94f0
UPS sorry caps was on and i was in a rush sorry
=(
http://img76.imageshack.us/img76/1808/expl7pb.png
AN EXPLOSION DOESNT HAPPEN CUZ GOD WANTS, IT HAPPENS WHEN A SOMETHING "EXPLODES
Perhaps you rushed your sig as well
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You can also use 'system("color xx");', which I believe is also covered in the windows.h header file.
Replace the first x with your desired background color, and the second x with your desired foreground or text color (check the table below for what to replace the x's with). Keep in mind that this affects the whole application, where as jmd15's way can be used on certain pieces of text.
0 - Black
1 - Blue
2 - Green
3 - Aqua
4 - Red
5 - Purple
6 - Yellow
7 - White
8 - Gray
9 - Light Blue
A - Light Green
B - Light Aqua
C - Light Red
D - Light Purple
E - Light Yellow
F - Bright White
Actually the way you are doing it Flakster doesn't require you to include windows.h, so I think your way is better(because less includes=smaller program size). That command is also quite fun to play around with in DOS.
Last edited by jmd15; 10-17-2005 at 01:21 PM.
Trinity: "Neo... nobody has ever done this before."
Neo: "That's why it's going to work."
c9915ec6c1f3b876ddf38514adbb94f0