Other Bases

It is not a coincidence that we use base 10; we have 10 fingers. One can imagine a different base, however. Using the rules found in base 10, you can describe base 8:

  1. The digits used in base 8 are 0–7.

  2. The columns are powers of 8: 1s, 8s, 64s, and so on.

  3. With n columns you can represent 0 to (8n–1).

To distinguish numbers written in each base, write the base as a subscript next to the number. The number fifteen in base 10 would be written as 1510 and read as “one, five, base ten.”

Thus, to represent the number 1510 in base 8 you would write 178. This is read “one, seven, base eight.” Note that it can also be read “fifteen” as that is the number it continues to represent.

Why 17? The 1 means 1 eight, and the 7 means 7 ones. One eight ...

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.