473,387 Members | 1,904 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,387 software developers and data experts.

outputing hexidecimal using cout

Greetings. I need to output a hexadecimal number using cout. I've done
this as shown below:
cout << hex << stuff;
But it outputs the letters in lowercase. Is it possible to output
a,b,c,d,e, and f in upper case instead of lower case?

Thanks

-D

Jul 19 '05 #1
3 6016
On Sun, 12 Oct 2003 20:45:45 -0400, daniel aviad galron wrote:
Greetings. I need to output a hexadecimal number using cout. I've done
this as shown below:
cout << hex << stuff;
But it outputs the letters in lowercase. Is it possible to output
a,b,c,d,e, and f in upper case instead of lower case?


Did you try

cout << hex << uppercase << stuff;

?
Jul 19 '05 #2

"daniel aviad galron" <ga****@cis.ohio-state.edu> wrote in message
news:3F**************@cis.ohio-state.edu...
Greetings. I need to output a hexadecimal number using cout. I've done
this as shown below:
cout << hex << stuff;
But it outputs the letters in lowercase. Is it possible to output
a,b,c,d,e, and f in upper case instead of lower case?


Yes. Your needs have been anticipated and provided
via another handy-dandy stream manipulator:

#include <iomanip>
#include <iostream>

int main()
{
std::cout << std::hex << std::uppercase << 0x3d << '\n';
return 0;
}

-Mike
Jul 19 '05 #3

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:ie*****************@newsread4.news.pas.earthl ink.net...

"daniel aviad galron" <ga****@cis.ohio-state.edu> wrote in message
news:3F**************@cis.ohio-state.edu...
Greetings. I need to output a hexadecimal number using cout. I've done
this as shown below:
cout << hex << stuff;
But it outputs the letters in lowercase. Is it possible to output
a,b,c,d,e, and f in upper case instead of lower case?


Yes. Your needs have been anticipated and provided
via another handy-dandy stream manipulator:

#include <iomanip>


Should be:

#include <ios>

-Mike
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bissatch | last post by:
Hi, I have the following XML content in a file (main.xml): <?xml version="1.0" encoding="iso-8859-1"?> <menu> <option title="Home" href="home.php"> <option title="News" href="news.php">...
2
by: Antonio Ooi | last post by:
Hi, Probably due to my 'Language for non-Unicode Setting' in Regional Settings, my ASP page keeps outputing the date format as Chinese Simplified characters when issuing say, <%=Now()%>. In...
15
by: Bushido Hacks | last post by:
Hey c.l.c++ and/or c.g.a.opengl posters, How do I convert a hexidecimal string, traditionally used for defining colors with HTML, into a floating point array? In other words, how do I convert...
2
by: Damon | last post by:
I'm getting errors using XML deserialisation and CDATA sections when there are hexidecimal characters involved. If the CDATA section does not contain a hexidecimal values everything is fine....
3
by: charliewest | last post by:
Can some pls provide an example as to how to use the TypeConverter and/or WebColorConverter class to set a control color property to a hexidecimal value? Thanks in advance.
4
by: jdcrief | last post by:
Using Visual C++2005 Expression Edition Having trouble outputting the value referenced by the pointer and then outputing the address of the pointer for the char. Any ideas would be greatly...
1
by: JanaB | last post by:
I am writing a code that needs to read in a binary file. At the moment I don't have to do anything with the data, I just need to view the contents to compare its structure with another binary file....
3
by: tariq103 | last post by:
I am having trouble with a normally simple function, I am trying to read a text file and output what is in the file: #include <iostream> #include <cmath> #include <iomanip> #include <fstream>...
3
by: thesis99 | last post by:
I have an cout<<statement that my compiler does not like. I have checked it over and over and everything seams to be in order<< can anyone help. it is //cout<<"Change in temp.\tTotal length\tCange...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.