Ray's playground

 

bitset

 1 #include <iostream>
 2 #include <bitset>
 3 using namespace std;
 4 
 5 int main()
 6 {
 7     bitset<16> a(0xff01);
 8     cout << "a:" << a << endl;
 9 
10     bitset<32> b("100010");
11     cout << "b:" << b << endl;
12     cout << "count of b: " << b.count() << endl;
13 
14     b.flip();
15     cout << "b:" << b << endl;
16     cout << "count of b: " << b.count() << endl;
17 
18     cin.get();
19     return 0;
20 }

posted on 2011-03-24 22:03  Ray Z  阅读(151)  评论(0编辑  收藏  举报

导航