array into set in cpp code example
Example: how to convert array into set in c++
#include <iostream>
#include <unordered_set>
int main()
{
int A[] = { 1, 2, 3, 4, 5 };
std::unordered_set<int> s;
for (int i: A) {
s.insert(i);
}
for (int i: s) {
std::cout << i << " ";
}
return 0;
}