打印二进制的代码也不是那么容易的,不信写个看看,和下面这个(一本老外的C语言教材上的代码)比较一下,看看写的是否全面
c++就简单多了
cout << bitset<numeric_limits<unsigned int>::digits>(123) << endl;
// 还可以把二进制字符串转换为整数
cout << bitset<100>(string("100010110")).to_ulong() << endl;
发表于 @ 2008年03月10日 18:29:00|评论(loading...)|收藏