Arrays

Actually i faced a problem in my assignment .. I don't understand the idea of it .. The Question :: --->

write a c++ programe to take a decimal number integer number and displays its equivalent value in binary format.

--> I don't under stand DISPLAYS ITS VALUE IN BINARY FORMAT :D
--> I don't under stand DISPLAYS ITS VALUE IN BINARY FORMAT :D
it's a different system of numeration.
http://en.wikipedia.org/wiki/Numeral_system
For example:
510 = 1012
2810 = 1ะก16 = 348 = 111002
Firstly if you don't understand what binary is why're you doing a computing course, go look up that first.
Then all you need to understand is how many bits is in an integer, then just create a for loop to check for high bits and show the output.
I'll try :) .. Thank you all
I think you should display its representation as a character array or an object of type std::string.
Well a character only holds 8bit, and a string holds an array of characters... So not a very wise technique for converting a 32bit number to binary

Just use the number and iterate through the bits
Topic archived. No new replies allowed.