Binary format & literals in C++
cout « std::bitset<32>( 0b1000’0000’0000’0000 ) - Binary solo
C++14 binary literals and digit separator
Printing numbers in binary format in C++
In C++20 you’ll be able to use std::format to do this
otherwise
The easiest way is probably to create an std::bitset representing the value, then stream that to cout.
see also
Written on June 12, 2021, Last update on October 10, 2022
c++
bits
literals