Set

#include <iostream>
#include<set>
#include<iterator>
using namespace std;
int main()
{
      set < int > s;
      set < int > :: iterator i;
      s.insert(2);
      s.insert(5);
      s.insert(5);
      s.insert(10);
      for( i = s.begin(); i !=s.end(); i++ ) {
      printf("%d\n", *i);
      }
      system("pause");
      return 0;
}
              
      


This is the output:
2
5
10

0 comments:

Post a Comment