set 3a 3aclear in c 2b 2b

Solutions on MaxInterview for set 3a 3aclear in c 2b 2b by the best coders in the world

showing results for - "set 3a 3aclear in c 2b 2b"
Brice
29 Aug 2016
1// set::clear
2#include <iostream>
3#include <set>
4
5int main ()
6{
7  std::set<int> myset;
8
9  myset.insert (100);
10  myset.insert (200);
11  myset.insert (300);
12
13  std::cout << "myset contains:";
14  for (std::set<int>::iterator it=myset.begin(); it!=myset.end(); ++it)
15    std::cout << ' ' << *it;
16  std::cout << '\n';
17
18  myset.clear();
19  myset.insert (1101);
20  myset.insert (2202);
21
22  std::cout << "myset contains:";
23  for (std::set<int>::iterator it=myset.begin(); it!=myset.end(); ++it)
24    std::cout << ' ' << *it;
25  std::cout << '\n';
26
27  return 0;
28}
similar questions
queries leading to this page
set 3a 3aclear in c 2b 2b