473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

assigning color to text in c++

hi,i want to change the colour of specific integer to be displayed ,using c++.
the default colour is white ,i just want to highlight a specific number in the window............just that.plz help
Oct 1 '07 #1
2 1680
Meetee
931 Expert Mod 512MB
hi,i want to change the colour of specific integer to be displayed ,using c++.
the default colour is white ,i just want to highlight a specific number in the window............just that.plz help
If you are working in VC++, then use

Expand|Select|Wrap|Line Numbers
  1.  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0); //replace the 0 with a number for the color you want
  2.  
  3. cout << "Your text here" << endl;
These are some color codes

Expand|Select|Wrap|Line Numbers
  1. #define BLACK 0
  2. #define BLUE 1
  3. #define GREEN 2
  4. #define CYAN 3
  5. #define RED 4
  6. #define MAGENTA 5
  7. #define BROWN 6
  8. #define LIGHTGREY 7
  9. #define DARKGREY 8
  10. #define LIGHTBLUE 9
  11. #define LIGHTGREEN 10
  12. #define LIGHTCYAN 11
  13. #define LIGHTRED 12
  14. #define LIGHTMAGENTA 13
  15. #define YELLOW 14
  16. #define WHITE 15 
Oct 1 '07 #2
arnaudk
424 256MB
And in Linux, have a look at the ncurses library.

Arnaud
Oct 1 '07 #3

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

Similar topics

5
by: gtz669 | last post by:
I have a class which I am using for data stroage. I declare an instance of that class in my main class which is running my java applet. I Iassign it a value in the init () function and it works...
10
by: rxl124 | last post by:
I have files that I only need one field that I need to grep it out and I am trying to assign that to another file. (It happens that one field that I am looking for has some other character that...
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
14
by: Eric Bantock | last post by:
Very basic question I'm afraid. Once an array has been declared, is there a less tedious way of assigning values to its members than the following: myarray=8; myarray=3; myarray=4; myarray=0;...
1
by: mhnazly | last post by:
i'm trying to read data from SQL Server database using data reader and assigned it to a label in my asp.net web application. but when the button is clicked, nothing appears. please help, thanks. ...
0
by: Stephen Graybeal | last post by:
I am having a problem. I have inherited a custom control from a combobox and when the user inputs a value, it adds to the original text. When assigning the new value to the ComboBox.Text...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
3
by: JJ_377 | last post by:
I made a user control to gather usa address information and would like to know why the following doesn't work (I am assigning the valid of textbox in a second instance of the control from the first...
3
by: Ricky W. Hunt | last post by:
I came across something by accident; assigning one object to another (as in object1 = object2) allows me to "work on" object2 just like it was object1. For instance, in order to be able to...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.