fork(19) download
  1. #include <map>
  2. #include <string>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main(int argc, char* argv[])
  8. {
  9. map<string, int> my_map;
  10.  
  11. my_map.insert(pair<string, int>("Ab", 1));
  12. my_map.insert(pair<string, int>("Abb", 2));
  13. my_map.insert(pair<string, int>("Abc", 3));
  14. my_map.insert(pair<string, int>("Abd", 4));
  15. my_map.insert(pair<string, int>("Ac", 5));
  16. my_map.insert(pair<string, int>("Ad", 5));
  17.  
  18. cout<<my_map.lower_bound("Ab")->second<<endl;
  19. cout<<my_map.upper_bound("Ab")->second<<endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 2988KB
stdin
Standard input is empty
stdout
1
2