469,085 Members | 1,020 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,085 developers. It's quick & easy.

how to convert a decimal no. into a bin, oct & hexa no. using builtin function in C++

is there any expert who could guide me making a C++ program. I want to convert a Decimal number into a Binary, Octal and a Hexadecimal Number using a C++ Built-in Function(if there exist any).
Mar 31 '07 #1
2 2877
horace1
1,510 Expert 1GB
is there any expert who could guide me making a C++ program. I want to convert a Decimal number into a Binary, Octal and a Hexadecimal Number using a C++ Built-in Function(if there exist any).
you can read and write in various number formats using IO manipulators, see
http://www.cppreference.com/io_flags.html

otherwise have a look at this on conversion between number systems
http://en.wikipedia.org/wiki/Binary_numeral_system#Conversion_to_and_from_other _numeral_systems
Mar 31 '07 #2
Savage
1,764 Expert 1GB
is there any expert who could guide me making a C++ program. I want to convert a Decimal number into a Binary, Octal and a Hexadecimal Number using a C++ Built-in Function(if there exist any).
Maybe you can convert them with format specifiers

"%o"-unsigned octal

"%x"-unsigned hexadecimal with lowercase characters

"%X-unsigned hexadecimal with upercase characters
Mar 31 '07 #3

Post your reply

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

Similar topics

3 posts views Thread by Golan | last post: by
2 posts views Thread by [Gho] | last post: by
2 posts views Thread by Nadav | last post: by
4 posts views Thread by Edwin Knoppert | last post: by
1 post views Thread by Chandra | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.