how to replace a string
string replacestring(string str, string old, string new){ while (str.find(old) != string::npos){ str.replace(str.find(old), old.size(), new); } return str; } string str("I will replace every 'o' with 'a'."); replacestring(str, "o", "a");