Subscribe Us

Responsive Advertisement

Advertisement

Almost everything about bitset

 

Almost everything about bitset



#include<bits/stdc++.h>

using namespace std;

int main()

{

  bitset<32> c;

  bitset<32> b(10);

  cout<<b<<endl;

   bitset<32> a(string("101"));

   cout<<a.to_ullong()<<endl;

   c=5;

   cout<<c<<endl;

   //bitset operatio

   bitset<6> d;

   d.set();

   cout<<d<<endl;  //convert all bit in one;

   d.reset(); //convert all bit in zero

   cout<<d<<endl;

    d=11;

    cout<<d<<endl;

   cout<< d.count()<<endl;

   d.flip();

   cout<<d<<endl;


    return 0;

}


Post a Comment

0 Comments