While @Hengry is correct why not use a bubble sort or selection sort it will give any numbers in acending order if used with an array so just make a function that will make an array off the user input something like this
1 2 3 4 5 6 7 8
int *makeArray(int size)
{
int *ptr;
ptr = newint[size];
return ptr;
}
have that with in a function then assign it in main with something like this someArray = makeArray(num);
As for the selection sort you can make a function like this
Something like that should work for selection sort sorry i m doing this on my phone so mind the errors if there are any and to do descending you can just reverse it sorry would put it up but really tired lol have fun and i hope it helped.