fork download
  1. #include <iostream>
  2. #include <limits>
  3.  
  4. void disp_binary(unsigned u)
  5. {
  6. for(unsigned t = 1 << (sizeof(t)*8-1); t; t >>= 1)
  7. std::cout << static_cast<bool>(u & t);
  8. std::cout << std::endl;
  9. }
  10.  
  11. int main() {
  12.  
  13. disp_binary(std::numeric_limits<unsigned>::max());
  14. disp_binary(2863311530U);
  15. // your code goes here
  16. return 0;
  17. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
11111111111111111111111111111111
10101010101010101010101010101010