c++ 十六进制转二进制数

I recently introduced the Decimal Number System, the one we are used as humans.

我最近介绍了小数系统 ,即我们用作人类的系统。

As I said in that post, as humans we commonly have 10 fingers and we can count up to 10, hence the popularity of that system in our history.

就像我在那篇文章中所说的那样,作为人类,我们通常有10个手指,我们最多可以数10个手指,因此该系统在我们的历史中非常流行。

The Binary Number System is the second most important system for our species, as it led the electronics and computer revolution.

二进制数系统是对我们物种而言第二重要的系统,因为它引领了电子和计算机革命。

In electronics, we have 2 states: 0 or 1. There’s 0 volts, or there’s 5 (or 9, 12, whatever). A gate is open, or it’s closed.

在电子领域,我们有2种状态:0或1。有0伏,或者有5伏(或9、12,无论如何)。 门是打开的还是关闭的。

It’s either one or the another.

这是一个或另一个。

The digit in the binary number system is called bit.

二进制数字系统中的数字称为bit

As the decimal number system, also the binary number system is positional.

作为十进制数字系统,二进制数字系统也是positional

We sum each digit in the binary number system mutiplied by the power of 2 depending on their position, starting at position 0 from the right.

我们将二进制数字系统中的每个数字相加,并乘以2的幂,具体取决于它们的位置,从右边的位置0开始。

Given that:

鉴于:

\[2^0\] equals to 1

\ [2 ^ 0 \]等于1

\[2^1\] equals to 2

\ [2 ^ 1 \]等于2

\[2^2\] equals to 4

\ [2 ^ 2 \]等于4

\[2^3\] equals to 8, and so on..

\ [2 ^ 3 \]等于8,依此类推。

We can represent numbers using a series of bits:

我们可以使用一系列位来表示数字:

1 can be represented as \[1\times2^0\]

1可以表示为\ [1 \ times2 ^ 0 \]

10 can be represented as \[1\times2^1 + 0\times2^0\]

10可以表示为\ [1 \ times2 ^ 1 + 0 \ times2 ^ 0 \]

111 can be represented as \[1\times2^2 + 1\times2^1 + 1\times2^0\]

111可以表示为\ [1 \ times2 ^ 2 +1 \ times2 ^ 1 +1 \ times2 ^ 0 \]

Leading zeros in a number can be dropped, or added if needed, because they do not mean anything on the left of the top left 1: 110 can be represented a 0110 or 00000110 if needed. It holds the same exact meaning, because as the system above explained, we are simply multiplying a power of 2 times zero.

可以删除或添加数字中的前导零,因为它们并不意味着左上角1110都可以表示011000000110如果需要)。 它具有相同的确切含义,因为正如上面的系统所解释的,我们只需将2的幂乘以零即可。

Using binary numbers we can represent any kind of number in the decimal number system.

使用二进制数字,我们可以表示十进制数字系统中的任何类型的数字。

We need to have an adequate number of digits to represent enough numbers. If we want to have 16 numbers, so we can count from 0 to 15, we need 4 digits (bits). With 5 bits we can count 32 numbers. 32 bits will give us 4,294,967,296 possible numbers.

我们需要有足够的数字来表示足够的数字。 如果我们要有16个数字,那么我们可以从0到15进行计数,我们需要4个数字(位)。 使用5位,我们可以计算32个数字。 32位将给我们4,294,967,296可能的数字。

64 bits will give us 9,223,372,036,854,775,807 possible numbers. It grows pretty quickly.

64位将为我们提供9,223,372,036,854,775,807可能的数字。 它增长很快。

Here is a simple conversion table for the first 4 digits, which we can generate using just 2 bits:

这是前4位的简单转换表,我们只需使用2位就可以生成:

Decimal number Binary number
0 00
1 01
2 10
3 11
小数 二进制数
0 00
1个 01
2 10
3 11

Here is a simple conversion table for the first 8 digits:

这是前8位数字的简单转换表:

Decimal number Binary number
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
小数 二进制数
0 000
1个 001
2 010
3 011
4 100
5 101
6 110
7 111

If you notice, I repeated the above sequence, adding 1 instead of 0 in the series from 4 to 7.

如果您注意到,我重复了上述顺序,在从4到7的序列中加了1而不是0

Here is a simple conversion table for the first 16 digits:

这是前16位的简单转换表:

Decimal number Binary number
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
小数 二进制数
0 0000
1个 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111

Again, I repeated the sequence we used to get the first 8 numbers, prepended 0 to the first set 0-7 and prepended 1 to 8-15.

再次,我重复了我们用来获得前8个数字的顺序,将0附加到第一个数字0-7之前,将1附加到8-15。

I’ll soon talk about performing operations like sum and division with binary numbers, the hexadecimal numbers system, how to convert from binary to decimal and to hexadecimal, without looking at tables like these, and vice versa.

我将很快讨论如何执行诸如用二进制数求和和除法,十六进制数系统,如何从二进制转换为十进制以及转换为十六进制的操作,而无需查看此类表,反之亦然。

翻译自: https://flaviocopes.com/binary-number-system/

c++ 十六进制转二进制数

c++ 十六进制转二进制数_二进制数制相关推荐

  1. 二进制十进制十六进制转换_二进制数制到十进制数制的转换

    二进制十进制十六进制转换 Prerequisite: Number systems 先决条件: 数字系统 To convert binary number to its respective deci ...

  2. c++将十进制转换为二进制 小数_二进制、八进制、十六进制与转换

    将二进制.八进制.十六进制转换为十进制 二进制.八进制和十六进制向十进制转换都是非常容易的,就是"按权相加". 所谓"权",也即"位权". ...

  3. VB 进制转换大全(十进制、十六进制、八进制、二进制、二进制流)互转

    模块包含了下面的各种转换: 二进制转十进制 二进制转化为八进制 二进制转化为十六进制 八进制转化为十进制 八进制转化为二进制 八进制转化为十六进制 十进制转二进制 十进制转化为八进制 十进制转化为十六 ...

  4. c语言2进制16进制 表格,标题:整数进制转换(十六进制,十进制,二进制)--表格法...

    标题:整数进制转换(十六进制,十进制,二进制)--表格法 在计算机里,最基本的存储单位为字节(Byte,常说的大B),1个字节包含8位(bit,常说的小b).计算机的数据就是一个字节一个字节的形式存储 ...

  5. java中各进制之间的转换(十进制转十六进制、十进制转二进制、二进制转十进制、二进制转十六进制)...

    在java编辑中有没有遇到经常需要进行java中各进制之间的转换(十进制转十六进制.十进制转二进制.二进制转十进制.二进制转十六进制)的事情呢?下面我们就来分析一下各自是怎么转换的: [java] / ...

  6. 二进制除法移位相减_二进制转化、、、移位运算

    参考资料: https://www.cnblogs.com/wxb20/p/6033458.html https://www.cnblogs.com/joahyau/p/6420619.html ht ...

  7. c++二进制转十进制_二进制,八进制,十进制,十六进制转换详解~

    点 击 上 方 蓝 字 关 注 我 们 哦 ^-^ 本文思维导图: 1.数制:用一组固定的数字和一套统一的规则来表示数目的方法称为数制. 进位计数制的要素: ①.数码:用来表示进制数的元素. 二进制: ...

  8. c++十六进制转十进制_一文帮你详细图解二进制、八进制、十进制、十六进制之间的转换...

    1.背景(Contexts) 之前使用SQL把十进制的整数转换为三十六进制,SQL代码请参考:SQL Server 进制转换函数,其实它是基于二.八.十.十六进制转换的计算公式的,进制之间的转换是很基 ...

  9. python十六进制转为二进制数_python进制转换(二进制、十进制和十六进制)及注意事项...

    使用内置函数实现进制转换实现比较简单,主要用到以下函数: bin().oct().int().hex() 下面分别详解一下各个函数的使用(附实例) 第一部分:其他进制转十进制 1.二进制转十进制 使用 ...

  10. 进制转换二进制转八进制_将二进制数制转换为八进制数制

    进制转换二进制转八进制 Prerequisite: Number systems 先决条件: 数字系统 To convert binary numbers into octal numbers, we ...

最新文章

  1. winlogon.exe错误:小心设置搜狗拼音输入法
  2. Bean的拷贝之BeanUtils
  3. AI芯片浮出新玩家OURS,来者何人?新晋图灵奖得主华人弟子谭章熹
  4. 春天:谁是最得意的诗人?
  5. python3 模板库 好用_关于3个Python模板库的比较
  6. rrt matlab算法,rrt算法matlab代码
  7. 天津科技大学计算机科学与信息工程学院,天津科技大学计算机科学与信息工程学院简介...
  8. java启动项目出现The Tomcat connector configured to listen on port 7014 failed to start. The port may alrea
  9. JAVA实验二:设计一个教师类Teacher(属于cn.net.sdkd包)实现接口进行排序等
  10. macd金叉kdj死叉的准确率_MACD金叉不涨又死叉
  11. 微信小程序-000-签到功能-011-我报名过的活动-查看详情
  12. 什么是函数的副作用——理解js编程中函数的副作用
  13. 70行代码撸一个桌面自动翻译神器!
  14. 电子商务平台简介——Makingware
  15. ssm+jsp计算机毕业设计CheatEngine学习系统4i3k0(程序+LW+源码+远程部署)
  16. 如何非常有礼貌地回复 论文评阅人的 意见?
  17. 天津大学计算机博士几年毕业,在职读博士几年毕业?
  18. KTV项目(歌星点歌)
  19. 工厂方法模式——应用最广泛的模式
  20. HP服务器OA访问故障的低级错误

热门文章

  1. 国内四大炒股软件APP 全面技术解析
  2. HBase 官方文档中文版
  3. c语言ad转换实验报告,苏州大学实验报告-实验四ad转换模块实验报告
  4. MCU OTA升级流程
  5. altium09怎么查元器件_Altium Designer中怎么查找元器件
  6. 支付宝沙箱集成无法唤起客户端
  7. 数字图像处理 matlab图像的几何运算 实验三 旋转 缩放 裁剪 镜像变换 平移
  8. 信息技术测试计算机疑难问题处理,江苏省中小学信息技术等级考试常见问题处理.doc...
  9. 2021年下半年软考真题软件设计师真题答案(上午题)
  10. 【单片机】2.4 AT89S52的存储器结构