C++中的bitset

http://www.cppblog.com/mydriverc/articles/33991.html

 

1
2
3
4
5
6
7
8
9
10
11
12
13

int main()
{
    string str = "0101";
 
    bitset<32> b1(str);
    bitset<32> b2(5);
 
    cout << b2[3] << endl;
    cout << b2[2] << endl;
    cout << b2[1] << endl;
    cout << b2[0] << endl;
    return 0;
}
posted @ 2013-07-16 18:15  helloweworld  阅读(236)  评论(0编辑  收藏  举报