By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,376 Members | 3,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,376 IT Pros & Developers. It's quick & easy.

how to give color for each print out indivisualy

P: 6
//* if i want to give for each out put word
what kind of data or preprocesser i have
to use *//
// for example

int main(){
int color;
cout << "please enter 1- 2 : ";
cin >> color;
switch(color){
case 1:
system( " color 0a);
cout << " green "<< endl;
break;
case 2:


system("color 0c" );
cout <<" red " << endl;
break;
default:
cout << " wrong key "<< endl;
}
return 0;
}
Apr 16 '16 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
There's no provision in C or C++ for color.

You need to acquire a graphics library that works with your compiler and operating system. Then you write your C/C++ code to make calls to functions in that library to do your color changing.

Of course, these libraries are written in C/C++ but it requires expert programmers to do it. Better to use one of these than do it yourself.
Apr 16 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.