Write number N in basis M

Posted by VaioIsBorn on Stack Overflow See other posts from Stack Overflow or by VaioIsBorn
Published on 2010-03-20T12:08:17Z Indexed on 2010/03/20 12:11 UTC
Read the original article Hit count: 344

Filed under:
|

I know how to do it mathematically, but i want it now to do it in c++ using some easy algorithm. Is is possible ?

The question is that i need some methods/ideas for writing a number N in basis M, for ex. 14 in basis 3 = 2*(3^0) + 1*(3^1) + 1*(3^2) etc.

© Stack Overflow or respective owner

Related posts about c++

Related posts about math