change colors ?



I have written c++ prog .. and I need to ... if(x<30) .. print x with Red color or any color .. I will send x to file after I ask user to enter his Midtearm Exam .. and after he Enter the degree ..."if" will test his degree ..


and when I want to print all info on screen .. I want it Red .. but if it is x>31 will print it green ... < < < for example ..


what should I do ?
If you mean on the terminal window, try with the (n)curses library
Here are some examples of using colors with ncurses.
http://www.cplusplus.com/forum/general/11032/page1.html#msg52049
http://www.cplusplus.com/forum/general/11032/page2.html#msg52617

If you don't want to use ncurses, you'll have to play with terminfo directly...
Sorry but I think this lib is not included .. when I make c++ compile all functions was not declared .. ? this c or c++ ?

or how can I download this Lib ..? or if there are other way like windows.h ? I don't know ,,

Wait... you're using Windows?
Last edited on
Nope ... ubuntu ...now tell me how
You should install the package libncurses5-dev or something like that
Topic archived. No new replies allowed.