#include <stdio.h>
typedef union
{
unsigned char byte;
struct
{
unsigned char low : 4;
unsigned char high: 4;
} bits;
}BCD;
unsigned char BCD2DEC(unsigned char bcd)
{
BCD cache;
cache.byte=bcd;
return cache.bits.high*10+cache.bits.low;
}
int main(void)
{
printf("%d\n",BCD2DEC(0x12));
return 0;
}
BCD转十进制
最新推荐文章于 2023-12-26 20:27:20 发布