char * recursivecombo(char *str, int choices, int level)
{
int len = strlen(str);
level++;
if( level == choices)
{
for (int i = 0; i < len -2; i++)
{
printf("%c", str[i]) ;
}
}
else
{
for (int i = 0; i < len - 2; i++)
{
printf("%c",str[i]);
recursivecombo(str.substr(1), level);
}
}
}
I want to use string instead of char*.
This is just a mock-up using a string. Some issues with your function
1)Where is your return value
2)If you intend to use string use cout, rather than printf, if it is C++
3)Use prefix ++.