Mar 1, 2013 at 8:38am UTC
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
Mar 1, 2013 at 12:48pm UTC
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.
Mar 2, 2013 at 10:51am UTC
I'll try :) .. Thank you all
Mar 2, 2013 at 12:57pm UTC
I think you should display its representation as a character array or an object of type std::string.
Mar 2, 2013 at 4:59pm UTC
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