标题:关于 c++ 的 bitset 求解释
取消只看楼主
七夜之华
Rank: 3Rank: 3
来 自:China
等 级:论坛游侠
威 望:5
帖 子:82
专家分:103
注 册:2014-9-7
结帖率:100%
已结贴  问题点数:20 回复次数:1 
关于 c++ 的 bitset 求解释
编译结果为7 和 9,  请高手解释   不太理解

#include<iostream>
#include<bitset>
using namespace std;
void main()
{
bitset<4> bit(1111);
cout<<bit.to_ulong()<<endl;
bitset<4> ait(1001);
cout<<ait.to_ulong()<<endl;

}

那对于以下的代码呢  编译结果为9  如何解释呢

#include<iostream>
#include<bitset>
using namespace std;
void main()
{
 bitset<5> a(00111);
 cout<<a.to_ulong();
}
搜索更多相关主题的帖子: include 
2014-09-21 22:49
七夜之华
Rank: 3Rank: 3
来 自:China
等 级:论坛游侠
威 望:5
帖 子:82
专家分:103
注 册:2014-9-7
得分:0 
嗨嗨,解释的很清楚呢,谢谢,我会继续努力的。。。。

#############################################
##########################################
因为不懂、才要学习、只有学习、才有进步。
2014-09-22 13:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-436434-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.276971 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved