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