fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <limits>
  4.  
  5. bool printbits(const std::string::value_type v) {
  6. for (std::intmax_t i = std::numeric_limits<std::string::value_type>::digits-1; i >=0 ; i--) {
  7. std::cout << ((v >> i) & 1ull);
  8. }
  9. return true;
  10. }
  11.  
  12.  
  13. bool MakeHoge(const std::string& s) {
  14.  
  15. for (auto& o : s) {
  16. printbits(o);
  17. std::cout << ' ';
  18. }
  19. std::cout << std::endl;
  20. return true;
  21. }
  22.  
  23. int main() {
  24. MakeHoge("Hello World!");
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1001000 1100101 1101100 1101100 1101111 0100000 1010111 1101111 1110010 1101100 1100100 0100001