November 2001
Beginner
1128 pages
29h 12m
English
Hexadecimal numbers are based on powers of 16. That means 10 in hexadecimal represents the value 16 + 0, or 16. To represent the values between 9 and hexadecimal 16, you need a few more digits. Standard hexadecimal notation uses the letters a–f for that purpose. C++ accepts either lowercase or uppercase versions of these characters, as shown in Table A.1.
| Hexadecimal digits | Decimal value | Hexadecimal digits | Decimal value |
|---|---|---|---|
| a or A | 10 | d or D | 13 |
| b or B | 11 | e or E | 14 |
| c or C | 12 | f or F | 15 |
C++ uses a 0x or 0X notation to indicate hexadecimal notation. Thus, 0x2B3 is a hexadecimal value. To find its decimal equivalent, you can evaluate the powers of 16:
| 0x2B3 (hex) | = 2×16[2] + 11×16[1] + 3×16[0] |
| = 2×256 ... |
Read now
Unlock full access