#include<iostream>
#include<map>
using namespace std;
int main(){
map<int, int> m;
m.insert(make_pair(1, 5));
map<int, int>::iterator ite;
ite = m.find(1);
if(ite != m.end()){
m.erase(1);
m.insert(make_pair(1, 6));
}else{
m.insert(make_pair(1, 6));
}
cout << ite->second << endl;
for(ite = m.begin(); ite != m.end(); ite++){
cout << ite->first << "\t" << ite->second << endl;
}
}
#include<iostream>
#include<map>
#include<set>
using namespace std;
int main(){
set<int> s;
s.insert(1);
s.insert(2);
s.insert(3);
set<int>::iterator ite;
ite = s.find(1);
if(ite == s.end()){
cout << "Not found" << endl;
}else{
cout << "Found" << endl;
}
s.erase(2);
if(s.count(3) != 0){
cout << "Found" << endl;
}else{
cout << "Not found" << endl;
}
for(ite = s.begin(); ite != s.end(); ite++){
cout << *ite << endl;
}
}