Could you please help me with the code?

i tried solving the question, seems like my whole approach is wrong

in these type of questions where you need custom sort for your array just create a custom function which you have created and do not pass any argument in the function call and
in the sort function you will have to give the same data type as of the vector you are sorting
Coding Blocks IDE
this is the changed code i have just made simple conditions in the custom sort function which are given in the question
it will make clear if clear mark it as resolved and rate my experience

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.