conditional sorting in c++ inbuilt funcion code example Example: stl sort in c++ sort(arr, arr+n, greater<int>()); // sorts in descending order