Sorted array question


what is wrong in it?

@Aditiverma
As you can see , your code prints 1 and 0 instead of “true” and “false” which is the expected output format. This is because any bool variable is printed as 1 if true and 0 if false in C++. If you wish to print the string “true” or “false” instead of 1 and 0 , use boolalpha with cout.

cout << boolalpha << sort(sort(arr,n);

This should solve your problem. Your rest of the code is perfectly fine.

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.