Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
#include
using namespace std; bool has_o(string item) { return item.find('o') != string::npos; } int main() { vector
cars = {"Volvo", "BMW", "Ford", "Mazda"}; vector
newcars(4); replace_copy_if(cars.begin(), cars.end(), newcars.begin(), has_o, (string)"Toyota"); for (string car : newcars) { cout << car << "\n"; } return 0; }
Toyota
BMW
Toyota
Mazda