0123456789
the octals numbers include only the representations for the values from 0 to 7:
01234567
and, therefore, its mathematical base is 8. In C++ octal numbers are denoted by beginning always with a 0 digit. Let's see how we would write the first numbers in octal:
octal decimal ----- ------- 0 0 (zero) 01 1 (one) 02 2 (two) 03 3 (three) 04 4 (four) 05 5 (five) 06 6 (six) 07 7 (seven) 010 8 (eight) 011 9 (nine) 012 10 (ten) 013 11 (eleven) 014 12 (twelve) 015 13 (thirteen) 016 14 (fourteen) 017 15 (fifteen) 020 16 (sixteen) 021 17 (seventeen)
Thus, for example, the number 17 (seventeen, or XVII in Roman) it is expressed 021 as an octal number in C++. We can apply the same mechanism that we saw previously for decimal numbers to the octal numbers simply by considering that its base is 8. For example, taking the octal number 071263:
therefore the octal number 071263 is expressed as 29363 in decimal numbers.
No comments:
Post a Comment