+ 3

How can we convert decimal numbers to binary in cpp

Number converter

11th Nov 2017, 9:18 AM
Kinjal
Kinjal - avatar
7 Answers
+ 9
C++ have a special library for dealing with binary data called bitset. I've written a code just for you! showing the memory usage differences https://code.sololearn.com/coKLNTzAuZn1/?ref=app
11th Nov 2017, 4:17 PM
AZTECCO
AZTECCO - avatar
+ 8
http://www.sanfoundry.com/cpp-program-decimal-binary-conversion/
11th Nov 2017, 9:22 AM
qwerty
qwerty - avatar
+ 5
for example, you need to calculate binary of 5. In this case.... 5/2=2, 5%2=1 2/2=1, 2%2=0 1/2=0, 1%2=1 so, binary of 5 is 101(the remainders from bottom to top) in case of 6.... 6/2=3, 6%2=0 3/2=1, 3%2=1 1/2=0, 1%2=1 so binary of 6 is 110
11th Nov 2017, 9:55 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 3
I made the program in javascript... https://code.sololearn.com/WBU6UjIarh7S/?ref=app It may help you to write the program in c++.. http://www.sanfoundry.com/cpp-program-decimal-binary-conversion/
11th Nov 2017, 2:00 PM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 1
@ MD. NAFIS UL HAQUE SHIFAT how can u do that in cpp?
11th Nov 2017, 1:12 PM
Kinjal
Kinjal - avatar
+ 1
Thank u so much 😆😆😆
11th Nov 2017, 4:19 PM
Kinjal
Kinjal - avatar
0
Ty all
11th Nov 2017, 2:06 PM
Kinjal
Kinjal - avatar