can anyone here give me a c++ example of result of a integer in base 2,4 and 8 please..
i am working on a program on this.
This is a discussion on need help with some functions here within the C++ Programming forums, part of the General Programming Boards category; can anyone here give me a c++ example of result of a integer in base 2,4 and 8 please.. i ...
can anyone here give me a c++ example of result of a integer in base 2,4 and 8 please..
i am working on a program on this.
What do you mean by "result of a integer in base 2,4 and 8"?
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Well
89
in base 8 is:
1 * 8 ^ 0 + 3 * 8 ^ 1 + 1 * 8 ^ 2
in base 4:
1 * 4 ^ 0 + 2 * 4 ^ 1 + 1 * 4 ^ 2 + 1 * 4 ^ 3
in base 2:
1 * 2 ^ 0 + 0 * 2 ^ 1 + 0 * 2 ^ 2 + 1 * 2 ^ 3 + 1 * 2 ^ 4 + 0 * 2 ^ 5 + 1 * 2 ^ 6
See a pattern?
You can use modulus and division in a loop to obtain the multipliers.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.