首页> 外文期刊>Electronic Design >EASILY CONVERT DECIMAL NUMBERS TO THEIR BINARY AND BCD FORMATS
【24h】

EASILY CONVERT DECIMAL NUMBERS TO THEIR BINARY AND BCD FORMATS

机译:轻松将十进制数转换为其二进制和BCD格式

获取原文
获取原文并翻译 | 示例
           

摘要

Here's a C/C++ program that converts decimal numbers ranging from 0 to 99,999 to binary and binary coded decimal (BCD) formats. Using a simple algorithm in conjunction with pointer arithmetic and bitwise shifting increases the conversion speed without introducing excessive memory overhead and programming complexity. When decimal numbers are within the range of 0 to 9, their binary and BCD representations are identical, requiring only four bits (0000 to 1001). When the numbers are within the range of 10 to 19, the binary representation varies between four and five bits, such as 1010 to 10011. The BCD representation uses eight bits, such as 0001 0000 to 00011001.
机译:这是一个C / C ++程序,该程序将范围从0到99,999的十进制数字转换为二进制和二进制编码的十进制(BCD)格式。将简单的算法与指针算术和按位移位结合使用可提高转换速度,而不会导致过多的内存开销和编程复杂性。当十进制数在0到9的范围内时,它们的二进制和BCD表示形式是相同的,仅需要四个位(0000到1001)。当数字在10到19的范围内时,二进制表示形式在4到5位之间变化,例如1010到10011。BCD表示使用8位,例如0001 0000到00011001。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号