how to sort a vector in a function C++ code example Example: sort a vector c++ sort(a.begin(), a.end());