cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
ASCII to decimal
ASCII to decimal
Feb 10, 2012 at 1:38pm UTC
htown
(26)
How would I convert a single ASCII character like 'A' 65 to its hex value 10?
Feb 10, 2012 at 1:45pm UTC
LB
(13399)
Just cast it to an int:
cout <<
"Character 'a' is "
<<
int
(
'a'
) <<
" (decimal) and "
<< hex <<
int
(
'a'
) <<
" (hex)"
<< endl;
http://www.cplusplus.com/reference/iostream/manipulators/hex/
Topic archived. No new replies allowed.