D.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers

The main use for octal and hexadecimal numbers in computing is for abbreviating lengthy binary representations. Figure D.7 highlights the fact that lengthy binary numbers can be expressed concisely in number systems with higher bases than the binary number system.

Fig. D.7 Decimal, binary, octal and hexadecimal equivalents.

Decimal number Binary representation Octal representation Hexadecimal representation
 0     0  0  0
 1     1  1  1
 2    10  2  2
 3    11  3  3
 4   100  4  4
 5   101  5  5
 6   110  6  6
 7   111  7  7
 8  1000 10  8
 9  1001 11  9
10  1010 12  A
11  1011 13  B
12  1100 14  C
13  1101 15  D
14  1110 16  E
15  1111

Get C++ How to Program, 10/e 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.