get top 3 elements vector sort c++ code example Example: std vector sort std::sort(myvector.begin(), myvector.end());