All subsequences of string

my code is printing all the subsequences but not in the correct order. even if I reverse the string then also the result does not match the required output.
here is my code–> https://ide.codingblocks.com/s/81089

Use this line of code for printing, since your logic will only be used to print from ascending order since you are using loop from start to end…

void printsubsequences(string str,string osf)
{
if(str.length()==0)
{
cout<<osf<<" ";
return;
}
char ch=str[0];
string ros=str.substr(1);
printsubsequences(ros,osf);
printsubsequences(ros,osf+ch);
}