Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

cpp merge two sets

#include <iostream>
#include <set>
#include <algorithm>
 
int main()
{
    std::set<int> odd = { 1, 3, 5 };
    std::set<int> even = { 2, 4, 6 };
 
    std::set<int> s(odd);
    s.insert(even.begin(), even.end());
 
    for (auto const &e: s) {
        std::cout << e << ' ';
    }
 
    return 0;
}
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #cpp #merge #sets
ADD COMMENT
Topic
Name
6+8 =