打印二进制位
来源:互联网 发布:尤克里里调音软件推荐 编辑:程序博客网 时间:2024/06/08 17:48
/****************************** 作者:cncoderalex 博客:http://blog.csdn.net/cncoderalex *******************************/#include<iostream>using namespace std;template <typename T>void PrintBinary(T value){int BytesCount = sizeof(T);unsigned long long Bit = 1;string str;for (int i = 0; i < BytesCount * 8; i++){if (value & Bit){str.append("1");}else{str.append("0");}Bit <<= 1;}int len = str.length();for (int i = len - 1; i >= 0; i--){printf("%c", str[i]);}printf("\n");}int main(){printf("http://blog.csdn.net/cncoderalex");printf("\n");int a = -1;unsigned char b = a;int c = b;char d = a;int e = b;short f = a;int g = b;PrintBinary(a);PrintBinary(b);PrintBinary(c);PrintBinary(d);PrintBinary(e);PrintBinary(f);PrintBinary(g);system("pause");return 0;}
0 0
- 打印二进制位
- 二进制位
- 二进制位按位取反
- 二进制位运算
- 二进制位运算
- 更新二进制位
- 更新二进制位
- 二进制位运算
- 更新二进制位
- 二进制位翻转:
- 二进制位运算
- 更新二进制位
- 二进制位运算
- 二进制位运算
- 二进制位运算
- 二进制位运算
- 二进制位操作技巧
- 二进制位的操作
- cookie详解
- iOS开发证书无效解决办法
- 图片控件 - GifView
- Android项目学习
- listview精确监听向上向下的滚动
- 打印二进制位
- mongodb insert()和save()的相同点和区别
- IPython Notebook error - Unreadable Notebook: Unsupported JSON nbformat
- Mapnik简要介绍
- vim ctags omnicppcomplete 无法自动提示成员变量,总是提示“找不到模式”的解决方法
- matlab mex编程:gcc编译器切换
- MongoDB 安装
- PlaySound(WIN32 播放WAV声音)
- Mac系统下的Eclipse实现Android真机调试