// This is an example of using begin() and end() #include #include #include // for srand, rand #include // for time using namespace std; int main() { set s; srand(time(nullptr)); // initialize random number generator for (int i=0; i<10; i++) // Add random numbers [0, 100) s.insert(rand() % 100); for (set::iterator it=s.begin(); it!=s.end(); ++it) cout << *it << ' '; cout << '\n'; // for (auto it=s.begin(); it!=s.end(); ++it) // cout << *it << ' '; // cout << '\n'; // for (auto val : s) // cout << val << ' '; // cout << '\n'; return 0; }