#include <iostream>
#include <set>

using namespace std;

int main()
{
    set<int> myset;
    myset.insert(7);
    myset.insert(2);
    myset.insert(-6);
    myset.insert(8);
    myset.insert(1);
    myset.insert(-4);

    set<int>::const_iterator it; // declare an iterator
    it = myset.cbegin(); // assign it to the start of the set
    while (it != myset.cend()) // while it hasn't reach the end
    {
        cout << *it << ' '; // print the value of the element it points to
        ++it; // and iterate to the next element
    }

    cout << '\n';
}