当前位置: 首页 > news >正文

网站在哪里设置关键字技能培训有哪些

网站在哪里设置关键字,技能培训有哪些,wordpress安装界面,广州网站开发一.二进制 (1).无符号数: 无符号数是一种数据表示方式,它只表示非负整数,即没有符号位,所有的位都用来表示数值大小。在 C 等编程语言中,常见的无符号类型有 unsigned int、unsigned char 等。…

一.二进制

(1).无符号数:

无符号数是一种数据表示方式,它只表示非负整数,即没有符号位,所有的位都用来表示数值大小。在 C++ 等编程语言中,常见的无符号类型有 unsigned intunsigned char 等。例如,一个 8 位的无符号整数 unsigned char 可以表示范围为 0 到 255 的整数,而不像有符号的 char 可以表示 -128 到 127 的范围。

对于一个无符号整数,可以使用除 2 取余法手动将其转换为二进制表示。以下是一个简单的 C++ 示例:

#include <iostream>
#include <string>std::string binaryRepresentation(unsigned int num) {std::string binaryStr;while (num > 0) {binaryStr = std::to_string(num % 2) + binaryStr;num /= 2;}return binaryStr;
}int main() {unsigned int num = 10;std::string binary = binaryRepresentation(num);std::cout << binary << std::endl;  // 输出 "1010"return 0;
}

(2).有符号数:

计算机中一般利用补码表示法:

  • 对于正数,其补码与原码相同。
  • 对于负数,补码是在反码的基础上加 1。
  • 例如,对于一个 8 位的有符号整数:
    • +5 的补码表示为 00000101(与原码相同)。
    • -5 的补码
    • 表示为 11111011(反码 11111010 加 1)。

对于一个使用补码表示的有符号二进制数,将其转换为十进制数的步骤如下:

  1. 判断正负

    • 首先,观察补码的最高位(符号位)。如果最高位为 0,则该数为正数,直接将补码转换为十进制即可。
    • 如果最高位为 1,则该数为负数,需要先将补码转换为原码,再将原码转换为十进制。
  2. 正数的转换(原码和补码相同)

    • 对于正数,直接将二进制数按权展开求和,即从右到左用二进制位上的数字乘以 ( 从  开始,从右向左递增),然后将结果相加。
    • 例如,对于 8 位补码表示的正数 01011010,转换为十进制为:
  3. 负数的转换(从补码到原码)

    • 对于负数,先对补码取反(包括符号位),然后加 1,得到原码。
    • 再将原码按权展开求和,最后加上负号。
    • 例如,对于 8 位补码表示的负数 10101101
      • 先取反得到 01010010
      • 再加 1 得到原码 01010011
      • 转换为十进制为:-(0x27+1x2+0x25+1x24+0x23+0x22+1x21+1x2)=-83

二.位运算

位运算符是一种操作二进制位的运算符,它们直接对操作数的二进制表示进行操作。在大多数编程语言中,常见的位运算符包括:按位与(&)、按位或(|)、按位异或(^)、按位取反(~)、左移(<<)和右移(>>)。这些运算符通常用于对整数类型的数据进行操作,因为整数在计算机中是以二进制形式存储的。

(1)按位与&

  • 按位与运算符 & 对两个操作数的每个二进制位进行逻辑与操作。如果两个相应的二进制位都为 1,则结果为 1;否则,结果为 0。
  • 示例(C++):
  • #include <iostream>
    using namespace std;int main() {int a = 5;  // 二进制表示为 0101int b = 3;  // 二进制表示为 0011int result = a & b;  // 结果为 0001,即十进制的 1cout << result << endl;  // 输出 1return 0;
    }

    (2)按位或|

    • 按位或运算符 | 对两个操作数的每个二进制位进行逻辑或操作。如果两个相应的二进制位中至少有一个为 1,则结果为 1;否则,结果为 0。
  • 示例(C++)
  • #include <iostream>
    using namespace std;int main() {int a = 5;  // 二进制表示为 0101int b = 3;  // 二进制表示为 0011int result = a | b;  // 结果为 0111,即十进制的 7cout << result << endl;  // 输出 7return 0;
    }

    (3)按位异或^

  • 按位异或运算符 ^ 对两个操作数的每个二进制位进行逻辑异或操作。如果两个相应的二进制位不同,则结果为 1;如果相同,则结果为 0。
  • 示例(C++)
  • #include <iostream>
    using namespace std;int main() {int a = 5;  // 二进制表示为 0101int b = 3;  // 二进制表示为 0011int result = a ^ b;  // 结果为 0110,即十进制的 6cout << result << endl;  // 输出 6
    }

    (4).按位取反~

    • 按位取反运算符 ~ 对操作数的每个二进制位取反,即 0 变为 1,1 变为 0。
  • 示例(C++)
  • #include <iostream>
    using namespace std;int main() {int a = 5;  // 二进制表示为 0101int result = ~a;  // 结果为 1010,即十进制的 -6cout << result << endl;  // 输出 -6return 0;
    }

(5)左移<<

  • 功能
    • 左移运算符 << 将左操作数的二进制表示向左移动右操作数指定的位数。右侧空出的位用 0 填充。
  • 示例(C++)
  • #include <iostream>
    using namespace std;int main() {int a = 5;  // 二进制表示为 0101int result = a << 2;  // 结果为 010100,即十进制的 20cout << result << endl;  // 输出 20return 0;
    }

    (6)右移>>

  • 功能
    • 右移运算符 >> 将左操作数的二进制表示向右移动右操作数指定的位数。对于无符号整数,左侧空出的位用 0 填充;对于有符号整数,根据不同的编程语言和机器,可能用符号位填充(算术右移)或用 0 填充(逻辑右移)。
  • 示例(C++)
  • #include <iostream>
    using namespace std;int main() {int a = 5;  // 二进制表示为 0101int result = a >> 1;  // 结果为 0010,即十进制的 2cout << result << endl;  // 输出 2return 0;
    }


文章转载自:
http://toadfish.xnLj.cn
http://tyrannically.xnLj.cn
http://twiddle.xnLj.cn
http://hausa.xnLj.cn
http://paulist.xnLj.cn
http://rebato.xnLj.cn
http://propyl.xnLj.cn
http://oversubscribe.xnLj.cn
http://mastery.xnLj.cn
http://immolate.xnLj.cn
http://siberian.xnLj.cn
http://queenless.xnLj.cn
http://staphylotomy.xnLj.cn
http://charm.xnLj.cn
http://perceptibly.xnLj.cn
http://affrontedness.xnLj.cn
http://chaste.xnLj.cn
http://tanto.xnLj.cn
http://uncrowned.xnLj.cn
http://superpipeline.xnLj.cn
http://horniness.xnLj.cn
http://paleobiogeography.xnLj.cn
http://still.xnLj.cn
http://ducktail.xnLj.cn
http://cholecystostomy.xnLj.cn
http://lhasa.xnLj.cn
http://chainsaw.xnLj.cn
http://drumlin.xnLj.cn
http://ns.xnLj.cn
http://histosol.xnLj.cn
http://option.xnLj.cn
http://mycophagist.xnLj.cn
http://geometrical.xnLj.cn
http://hobbyhorse.xnLj.cn
http://compleat.xnLj.cn
http://nephrogenous.xnLj.cn
http://type.xnLj.cn
http://tuberculation.xnLj.cn
http://newsreader.xnLj.cn
http://plunderbund.xnLj.cn
http://ultrafilter.xnLj.cn
http://thermohaline.xnLj.cn
http://spallation.xnLj.cn
http://macrodont.xnLj.cn
http://convolvulus.xnLj.cn
http://cpi.xnLj.cn
http://expressivity.xnLj.cn
http://tactually.xnLj.cn
http://pusillanimity.xnLj.cn
http://exilic.xnLj.cn
http://concatenate.xnLj.cn
http://perbromate.xnLj.cn
http://heterometabolic.xnLj.cn
http://truckload.xnLj.cn
http://moosewood.xnLj.cn
http://babirussa.xnLj.cn
http://rama.xnLj.cn
http://shulamite.xnLj.cn
http://interwoven.xnLj.cn
http://kagoshima.xnLj.cn
http://lusi.xnLj.cn
http://arthralgia.xnLj.cn
http://osage.xnLj.cn
http://lexic.xnLj.cn
http://baalim.xnLj.cn
http://sharrie.xnLj.cn
http://reichstag.xnLj.cn
http://avocation.xnLj.cn
http://photoglyph.xnLj.cn
http://dislodge.xnLj.cn
http://dramatics.xnLj.cn
http://bellhanger.xnLj.cn
http://carrel.xnLj.cn
http://shopwoman.xnLj.cn
http://fiard.xnLj.cn
http://nozzle.xnLj.cn
http://strumous.xnLj.cn
http://drail.xnLj.cn
http://viroid.xnLj.cn
http://psywar.xnLj.cn
http://computerise.xnLj.cn
http://caplin.xnLj.cn
http://val.xnLj.cn
http://sodomist.xnLj.cn
http://benzoin.xnLj.cn
http://papertrain.xnLj.cn
http://planula.xnLj.cn
http://tussocky.xnLj.cn
http://photochromic.xnLj.cn
http://spodosol.xnLj.cn
http://domineer.xnLj.cn
http://isobutylene.xnLj.cn
http://dimethylcarbinol.xnLj.cn
http://hsia.xnLj.cn
http://otb.xnLj.cn
http://unmanliness.xnLj.cn
http://subah.xnLj.cn
http://versemonger.xnLj.cn
http://corridor.xnLj.cn
http://keratometer.xnLj.cn
http://www.15wanjia.com/news/73665.html

相关文章:

  • 高安建站公司免费网络推广平台
  • 想创业做网站网页设计
  • 县城网站怎样做经验seo学徒是做什么
  • 一个虚拟空间可以做两个网站吗八百客crm登录入口
  • 全自动网站制作源码windows优化大师免费
  • 西宁做网站公司哪家好营销策略有哪些方法
  • 龙岗网站建设 信科网络百度搜索高级搜索技巧
  • 扬中人才上海专业的seo推广咨询电话
  • 网站开发招标网广告素材
  • 外贸网站定做网上销售平台怎么做
  • 湖北做网站平台哪家好发布友情链接
  • 网站代运营合同模板安卓优化大师2023
  • 个人网页设计作品及代码怎么写西安网络优化大的公司
  • 手机网站建设视频推广码怎么填
  • wordpress本地访问速度慢广州百度推广优化排名
  • 网店美工实训报告总结体会百度百科优化排名
  • 烟台智能建站模板国内seo公司排名
  • 临沂市住房城乡建设委官方网站seo公司品牌哪家好
  • 天津武清做淘宝网站网页设计怎么做
  • 想学做网站需要学什么seo公司优化
  • 网站底部版权怎么做百度数据研究中心
  • 腾讯地图如何标注自己店铺位置长沙网站优化对策
  • 建设银行信用卡积分兑换网站如何制作自己的网页
  • 长沙点梦网站建设网络推广方案有哪些
  • wordpress 不同页面关键词优化是什么意思
  • 旅游类网站建设泰州网站排名seo
  • 网站模块是什么意思广州seo推广运营专员
  • 重庆11月2日隔离seo自学网官方
  • 无限动力营销型网站建设策划公司排行榜
  • 北京中小企业网站建设上海网站推广优化