Hey, please help how can I replace underscore with characters and memorize all the guessed letters..
#include <iostream>
#include <String>
using namespace std;
void replace(string & str, const string & from, const string & to)
{
if(from.empty())
return;
int start_pos = 0;
while((start_pos = str.find(from, start_pos)) != str.npos)
{
str.replace(start_pos, from.length(), to);
start_pos += to.length();
}
}
int main()
{
string text, result;
cin>>text;
result = text;
replace(result, "_", " ");
cout<<"Orginal text: "<<text<<endl;
cout<<"Result text: "<<result<<endl;
system("pause");
return 0;
}