1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
// set::clear
#include <iostream>
#include <set>
using namespace std;
int main ()
{
set<int> myset;
set<int>::iterator it;
myset.insert (100);
myset.insert (200);
myset.insert (300);
cout << "myset contains:";
for (it=myset.begin(); it!=myset.end(); ++it)
cout << " " << *it;
myset.clear();
myset.insert (1101);
myset.insert (2202);
cout << "\nmyset contains:";
for (it=myset.begin(); it!=myset.end(); ++it)
cout << " " << *it;
cout << endl;
return 0;
}
|