sort vector c++ greater code example Example: sort vector in descending order sort(a.begin(), a.end(), greater<int>());