#include <string>
#include <iostream>
#include <algorithm>
int main()
{
using std::string;
using std::cout;
using std::endl;
using std::replace;
string s("name");
replace(s.begin(), s.end(), 'n', 'x');
replace(s.begin(), s.end(), 'a','x');
cout << s << endl;
system("pause");
return 0;
}
Here is my code. this code output= xxame. my desired output is that their is a cin to input a word then replace 1st two letters. anyone could make it for me or any suggestions.