fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <bitset>
  5.  
  6. int main()
  7. {
  8. std::string myString = "Hi";
  9. std::vector<std::bitset<8>> vec;
  10.  
  11. // populate vector
  12. for (std::bitset<8> foo : myString)
  13. vec.emplace_back(foo);
  14.  
  15. // print vec content
  16. for (auto const &bits : vec)
  17. std::cout << bits << std::endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 4216KB
stdin
Standard input is empty
stdout
01001000
01101001