Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to get input in cpp 
Cpp :: how to declare 1-D array in C/C++ 
Cpp :: c++ initialize array with all zeros 
Cpp :: find length of array c++ 
Cpp :: convert int to string c++ 
Cpp :: how to run a c++ program in the background 
Cpp :: c++ shared pointer 
Cpp :: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. 
Cpp :: run c++ file putty 
Cpp :: default access modifier in c++ 
Cpp :: c++ loop through string 
Cpp :: calculator c++ 
Cpp :: delete map elements while iterating cpp 
Cpp :: sort vector in descending order 
Cpp :: reverse c++ 
Cpp :: c++ string to int conversion 
Cpp :: arguments to a class instance c++ 
Cpp :: how to check if a number is prime c++ 
Cpp :: abs in c++ 
Cpp :: c++ multidimensional vector 
Cpp :: vector search by element 
Cpp :: splice string in c++ 
Cpp :: cpp cin 
Cpp :: input in c++ 
Cpp :: stl sort in c++ 
Cpp :: Pyramid pattren program in C++ 
Cpp :: c++ add two matrix 
Cpp :: c++ function default argument 
Cpp :: modulo subtraction 
Cpp :: methods available for a stl vector 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =