How to create an unsigned long bitset in C++

1 Answer

0 votes
#include <iostream> 
#include <limits> 
#include <bitset> 

  
int main() 
{ 
    std::bitset<std::numeric_limits<unsigned long>::digits> bs(15); 
    
    std::cout << bs;

}

 
/*
run:
 
0000000000000000000000000000000000000000000000000000000000001111
 
*/

 



answered Nov 1, 2025 by avibootz

Related questions

1 answer 80 views
1 answer 159 views
159 views asked May 6, 2025 by avibootz
1 answer 187 views
1 answer 160 views
1 answer 132 views
...