c++ - Given very long binary, convert it to decimal -


first, part of hw. second, part of it, appreciate hints here.

i've implemented kind of bigint class, stores numbers sequences of zeros , ones - stores decimal binary.

my class can add numbers , multiply them.

ok, when multiply 2 large numbers, huge number.

my question - given really long binary number, how convert decimal?

i've found dividing 10, i'm not sure, if that's case... or is, , have implement binary dividing?

thanks...

binary means base 2 if have example 10100 , need base 10you apply following pattern, going last element first (right left): 2^0*0 + 2^1*0 + 2^2*1 + 2^3*0 + 2^4*1 = 20 raise 2 power a starting 0 length_of_binary_num-1 , multiply power binary digit string(right-to-left) or have aditional method on

convert binary decimal

also recommend using string binary since binary digits tend more strings integers


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -