帮帮我!我不知道二进制,十六进制,八进制,并逐位 [英] HELP! I don't know binary, hexadecimal, octal, and bit-wise
问题描述
我没有编程课前了解到这一点,但现在我需要知道这一点。什么是学习这些数字以及如何将它们转换成一些好的资源?我pretty多少我要记住这些类似次表。
I haven't learned this in programming class before, but now I need to know it. What are some good resources for learning these numbers and how to convert them? I pretty much am going to memorise these like the times table.
推荐答案
在我们的日常生活十进制,基数,或的基数 是 10
。
许多系统的基数告诉我们许多不同的数字是如何使用的。
在十进制系统中,我们使用数字 0
到 9
。
In our everyday decimal system, the base number, or radix is 10
.
A number system's radix tells us how many different digits are in use.
In decimal system we use digits 0
through 9
.
一个数字的意义是基数^ I
,其中 I
是数字的位置从右算起,开始零。
The significance of a digit is radix ^ i
, where i
is digit's position counting from right, starting at zero.
小数号 6789
细分:
6 7 8 9 radix ^ i
| | | | --------------
| | | +-- ones 10 ^ 0 = 1
| | +----- tens 10 ^ 1 = 10
| +-------- hundreds 10 ^ 2 = 100
+----------- thousands 10 ^ 3 = 1000
ones tens hundreds thousands
-----------------------------------------------
(9 * 1) + (8 * 10) + (7 * 100) + (6 * 1000)
= 9 + 80 + 700 + 6000
= 6789
此计划将帮助我们了解任意数量的系统以十进制的数字。
This scheme will help us understand any number system in terms of decimal numbers.
十六进制系统的基数是 16
,所以我们需要使用额外的数字 A ... F
表示 10 ... 15
。
让我们打破十六进制数 CDEFh
以类似的方式:
Hexadecimal system's radix is 16
, so we need to employ additional digits A...F
to denote 10...15
.
Let's break down hexadecimal number CDEFh
in a similar fashion:
C D E F radix ^ i
| | | | --------------
| | | +-- ones 16 ^ 0 = 1
| | +----- sixteens 16 ^ 1 = 16
| +-------- 256:s 16 ^ 2 = 256
+----------- 4096:s 16 ^ 3 = 4096
ones sixteens 256:s 4096:s
-----------------------------------------------
(Fh * 1) + (Eh * 16) + (Dh * 256) + (Ch * 4096)
= (15 * 1) + (14 * 16) + (13 * 256) + (12 * 4096)
= 15 + 224 + 3328 + 49152
= 52719
我们刚刚转换次数 CDEFh
十进制(即交换基 16
基地 10
)。
We have just converted the number CDEFh
to decimal (i.e. switched base 16
to base 10
).
在二系统中,基数是 2
,所以只有数字 0
和 1
被使用。
下面是二进制数转换 1010B
为十进制:
In binary system, the radix is 2
, so only digits 0
and 1
are used.
Here is the conversion of binary number 1010b
to decimal:
1 0 1 0 radix ^ i
| | | | --------------
| | | +-- ones 2 ^ 0 = 1
| | +----- twos 2 ^ 1 = 2
| +-------- fours 2 ^ 2 = 4
+----------- eights 2 ^ 3 = 8
ones twos fours eights
-----------------------------------------------
(0 * 1) + (1 * 2) + (0 * 4) + (1 * 8)
= 0 + 2 + 0 + 8
= 10
八系统 - 同样的事情,基数是 8
,数字 0 ... 7
都在使用。
八进制转换 04567
为十进制:
Octal system - same thing, radix is 8
, digits 0...7
are in use.
Converting octal 04567
to decimal:
4 5 6 7 radix ^ i
| | | | --------------
| | | +-- ones 8 ^ 0 = 1
| | +----- eights 8 ^ 1 = 8
| +-------- 64:s 8 ^ 2 = 64
+----------- 512:s 8 ^ 3 = 512
ones eights 64:s 512:s
-----------------------------------------------
(7 * 1) + (6 * 8) + (5 * 64) + (4 * 512)
= 7 + 48 + 320 + 2048
= 2423
那么,做一些系统之间的转换是简单地改变基数。
要了解位运算符,请参阅http://www.eskimo.com/~scs/cclass/int/sx4ab.html.
To learn about bitwise operators, see http://www.eskimo.com/~scs/cclass/int/sx4ab.html.
这篇关于帮帮我!我不知道二进制,十六进制,八进制,并逐位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!