fork download
  1. #include <iostream>
  2. #include <bitset>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. string str = bitset<32>(5).to_string();
  8. cout << str << endl;
  9. cout << str.substr(str.size()-4, 4) << endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
00000000000000000000000000000101
0101