제2 3 템 플 릿 18.3.5 비트 집합

2344 단어 집합 하 다.
//       18.3.5    

//Bitsets                ,             Bitsets         ,  != == &= ^= |= ~ <<= >>= []



//1 Bitsets   

/*#include <iostream>

#include <bitset>

using namespace std;

int main()

{

	bitset<8>bs( (long)131 );

	for(int i=(int)bs.size()-1; i>=0; i--)

	{

	    cout<<bs[i]<<" ";

	}

	cout<<endl;

	cout<<bs<<endl;	

	system("pause");

	return 0;

}*/



//2 Bitsets       

//bitset           

//!= == &= ^= |= ~ <<= >>= []

/*

!=       bitset      

==       bitset     

&=       bitset     

^=       bitset      

|=       bitset    

~      bitset

<<=   bitset    

>>=   bitset    

[x]     x     

*/

/*

#include <iostream>

#include <bitset>

using namespace std;

int main()

{

	bitset<8>bs( (long)131 );

	cout<<bs<<endl;	

	cout<<~bs<<endl;

	system("pause");

    return 0;

}*/





//3 Bitsets      

//any()             ,   true

//cout()           

//flip()   bits   

//none()         ,   true

//reset()      

//set()      

//size()             

//test()          

//to_string()   bitset      

//to_ulong()    ibtset     

/*

#include <iostream>

#include <bitset>

using namespace std;

int main()

{

	bitset<8>bs( (long)131 );

	//cout<<bs<<endl;	

	//cout<<~bs<<endl;

	//(1) flip()          ~    

	cout<<"flip:"<<bs.flip()<<endl;



	//(2) none  

	cout<<"none:"<<bs.none()<<endl;



	//(3)any()    none()    

	cout<<"any:"<<bs.any()<<endl;



	//(4) reset();  

	//bs.reset();

	//cout<<"none:"<<bs.none()<<endl;



	//(5)size  

	cout<<"size:"<<bs.size()<<endl;



	//(6)test()  

	cout<<"test:"<<bs.test(3)<<endl;



	//(7)set()  

	cout<<bs<<endl;

	bs.set(0,1);

	cout<<bs<<endl;



	//(8)to_string()

	string str = bs.to_string();

	cout<<str<<endl;



	//(9)to_ulong()

	unsigned long ul = bs.to_ulong();

	cout<<ul<<endl;





	//(10) cout()  

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

	

	system("pause");

    return 0;

}*/


좋은 웹페이지 즐겨찾기