Recursion-dictionary order(smaller) problem

getting all the test cases wrong
#include
#include
#include <string.h>
using namespace std;
void swap(char *x, char *y)
{
char temp;
temp = *x;
*x = *y;
*y = temp;
}
void permut(char *a, int l, int r, char *org)
{
if (l == r)
{

    if (strcmp(org, a) > 0){
        cout << a << endl;
    }
}
else
{
    for (int i = l; i <= r; i++)
    {
        swap((a + l), (a + i));
        permut(a, l + 1, r, org);
        swap((a + l), (a + i));
    }
}

}

bool mycomaper(char a, char b)
{
return int(a) < int(b);
}

int main()
{
char str[10];
char org[10];
cin >> str;
strcpy(org, str);
int len = strlen(str);

sort(str, str + len, mycomaper);


permut(str, 0, len - 1, org);

}

you have to print the ans is sorted order
and this approach will not give ans is sorted order

check this input
dcba

hence first you have to store all the possible orders in a vector and then sort the vector
after that print the elements of vector

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.