vector sort funtion code example Example 1: vector sort c++ sort(v.begin(), v.end()); Example 2: sort a vector c++ sort(a.begin(), a.end());