My problem is that I need to do a recursion for a string and change any e for an a. Every time I enter a word it only prints out the last letter.
My code so far:
string ReplaceEsWithAs(string s)
{
if (s.length() == 1)
{
if (s == "e")
{
s = "a";
return s;
}
else
{
return s;
}
}
else
{
return ReplaceEsWithAs(s.substr(1));
}
}