O'Reilly logo

Sams Teach Yourself C++ in One Hour a Day, Seventh Edition by Siddhartha Rao

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Working with Numbers: Binary and Hexadecimal

Understanding how the binary and hexadecimal number systems work is not critical to programming better applications in C++, but it helps you to better understand what happens under the hood.

Decimal Numeral System

Numbers that we use on a daily basis are in the range of 0–9. This set of numbers is called the Decimal Numeral System. As the system is comprised of 10 unique digits, it’s a system with base of 10.

Hence, as the base is 10, the zero-based position of each digit denotes the power of 10 that the digit is multiplied with. So

957 = 9 x 102 + 5 x 101 + 7 x 100 = 9 x 100 + 5 x 10 + 7

In the number 957, the zero-based position of 7 is 0, that of 5 is 1, and that of 9 is 2. These position ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required