Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- void remove (std::map<int,int> &mapa, int n)
- {
- auto a = mapa.begin();
- for(auto b = mapa.begin(); b!= mapa.end(); ++b )
- {
- if(a->second >= n)
- {
- mapa.erase(b);
- }
- }
- }
- int main() {
- std::map<int, int> map {{7, 1} , {3,8} , {5,7} , {1,4} , {4,5} , {8,3}};
- remove(map, 5);
- for (auto pair: map)
- {
- std::cout << pair.first << " " << pair.second << std::endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement