Mega Code Archive

 
Categories / C++ Tutorial / Bitset
 

Instantiate a bitset object for 8 bits, given an unsigned long init value

#include <bitset> #include <iostream> #include <string> int main () {     using namespace std;     bitset <8> eightbits (255);     cout << "The initial contents of eightBits: " << eightbits << endl;     return 0; }