plz check the code why no output is displayed
Move All X at End
Anshul, the approach you are following is not correct, You can use this approach as,
void movexatend(string str,string osf)
{
char ch=str[0];
if(str.length()==0)
{
cout<<osf;
return;
}
string ros=str.substr(1);
if(ch!=‘x’)
{
movexatend(ros,osf+ch);
}
else
{
movexatend(ros,osf);
cout<<ch;
}
}