Mega Code Archive

 
Categories / C++ Tutorial / Bitset
 

Instantiate a bitset object for holding 5 bits, initialize it to a bit sequence supplied by a string

#include <bitset> #include <iostream> #include <string> int main () {     using namespace std;     bitset <5> fiveBits (string ("10101"));     cout << fiveBits << endl;     return 0; }