how to convert array into set in c 2b 2b

Solutions on MaxInterview for how to convert array into set in c 2b 2b by the best coders in the world

showing results for - "how to convert array into set in c 2b 2b"
Carolina
17 Nov 2017
1#include <iostream>
2#include <unordered_set>
3 
4int main()
5{
6    int A[] = { 1, 2, 3, 4, 5 };
7 
8    std::unordered_set<int> s;
9    for (int i: A) {
10        s.insert(i);
11    }
12 
13    for (int i: s) {
14        std::cout << i << " ";
15    }
16 
17    return 0;
18}
19
Elora
27 May 2018
1set<int> res(arr, arr + sizeArr);