fork(5) download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. int main() {
  6. std::string x[] = {"I", "don't", "hate", "c++"};
  7. std::replace( std::begin( x ), std::end( x ), "hate", "love" );
  8. for( const auto &str : x )
  9. std::cout << str << ' ';
  10. std::cout << std::endl;
  11. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
I don't love c++