#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
int main()
{
// Vector of integers
std::vector<int> vecObj {11, 12, 13, 14, 15, 16, 12, 43, 12, 13, 11};
// Sort the values in vector
std::sort(vecObj.begin(), vecObj.end());
// Remove duplicate values from vector
vecObj.erase(std::unique(vecObj.begin(), vecObj.end()), vecObj.end());
// print all elements of vector
for(auto elem : vecObj) {
std::cout<<elem << ", ";
}
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter