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
Example Program:
#include <stdio.h> #include <stdlib.h> int main() { system("COLOR FC"); printf("Welcome to the color changing application!\n"); printf("Press any key to change the background color!\n"); getch(); system("COLOR 6C"); printf("Now the background color is Yellow and Text Color is light Red\n"); printf("Press any key to exit..."); getch(); return 0; }
display erroe
Deleteno change color.display error "illegal command:COLOR
Delete@deep, this will work if you use Code::Blocks in a Windows Operating System.
Deletei use dev c++ and it worked
Deleteworks :d
DeleteI use code::blocks on windows with this just fine.... It depends on your minGW version
Deleteyou have to include #include with the code system("color 0a") but this will change the entire screen not a single line
Delete(o)
ReplyDeleteNice post so thanks for share
ReplyDeleteDon't works at me. :( Nothing's changed.
ReplyDeleteuse conio.h
Deletenot working!!!!!!!!!! ;-( [-(
ReplyDelete#include
Delete#include
int main()
{
system("COLOR 03");
printf("Welcome to the color changing application!\n");
printf("Press any key to change the background color!\n");
printf("Press any key to exit...");
return 0;
}
#include
Delete#include
int main()
{
system("COLOR 03");
printf("Welcome to the color changing application!\n");
printf("Press any key to change the background color!\n");
printf("Press any key to exit...");
return 0;
}
#include
Delete#include
int main()
{
system("COLOR 03");
printf("Welcome to the color changing application!\n");
printf("Press any key to change the background color!\n");
printf("Press any key to exit...");
return 0;
}
Works Perfectly On Code::Blocks On Windows 8 ! Thank You :))
ReplyDeletesuccess tyvm :>)
ReplyDeletesuccess tyvm :>)
ReplyDeleteThank you!
ReplyDeletethanks but getch is not declared in this scope => cut getch();
ReplyDeleteillegal command color
ReplyDeleteWhat I type the code is:
#include
#include
#include
int main()
{
clrscr();
system("color 5");
printf("Hello");
getch();
return 0;
}
include header files and then run the program.its working properly
DeleteUpper case COLOR
Deleteuse #include
Delete#include
DeleteIllegal Command color. (on the console)
ReplyDelete#include
#include
#include
int main()
{
system("COLOR FC");
printf("Hello");
getch();
return 0;
}
system("color fc"); is true..
Deletenot ..system("COLOR FC");
i
Most people do not like to do the system() call.
ReplyDeleteThanks for this (h)
ReplyDeleteThanks for this (h)
ReplyDeleteIt works.. Thanks man!
ReplyDelete#include
ReplyDelete#include
HANDLE hStdoubt=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdoubt, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_RED);
#include
ReplyDelete#include
HANDLE hStdoubt=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdoubt, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_RED);
:-#
ReplyDeleteplease tell me how to change colour of specific colour in c++..
ReplyDelete//TO CHANGE THE COLOR OF OVER OUTPUT
ReplyDelete#include
#include
void main()
{
textcolor(YELLOW);
cprintf("Hello!");
getch();
}
note:
//the color which you want just type that color in capital and use cprintf also 8-)
How to writw this program in c++ ?
Deletedoest work in codeblock
DeleteIt will work in TC3 compiler but it will not work on other compilers such as code::blocks because they don't have built-in function named textattr(); it is not a function in c/c++ TC3 developed it and it is in conio.h header file and conio.h is not present in code::blocks that's why it is working on turbo C but not in code::blocks☺
Deleteworking fine in c++ visual studio..thanks (h)
ReplyDelete-__________________________________-
ReplyDeletehow to declared 'getch'
ReplyDeleteConio.h
Deletesame prlm bro how to change color???????
Deletebravoo (h)
ReplyDelete:p
ReplyDeleteXD damn not bad :)
ReplyDeleteWindows only, system specific. Bad code::blocks helper.
ReplyDeleteWindows specific. "system" is not platform neutral.
ReplyDeleteThis is windows C++ help, not even code::blocks, much less C++, general help. Bad advice.
It changes all terminal color and not further new lines only...
ReplyDeleteThanks for the tip but its not what I was looking for!
Thank you for sharing :)
ReplyDeleteHOW I CHANGE BACKGROUND COLOR IN C++
ReplyDeleteHOW TO CHANGE BACKGROUND COLOR
ReplyDeleteit didn't have #include and #include
ReplyDeleteHelpful
ReplyDelete(h)
ReplyDelete