对数组进行排序,从高到低

rec*_*gle 1 c++ arrays

我有一个包含多个整数的数组,是否有一种从高到低排序的常用方法?

ust*_*sta 27

#include <algorithm>
#include <functional>
int arr[ 5 ] = { 4, 1, 3, 2, 5 };
std::sort( arr, arr + 5, std::greater< int >() );
Run Code Online (Sandbox Code Playgroud)