I am trying a short code that uses an array, I basically want to replace the word hate for love when I call my function WordReplace but I keep printing the same thing:
I
Just use std::replace:
std::string x[] = {"I", "don't", "hate", "c++"}; std::replace( std::begin( x ), std::end( x ), "hate", "love" );
live example