fork(16) download
  1. #include <map>
  2. #include <string>
  3. #include <iostream>
  4. int main()
  5. {
  6. std::map<int, std::string> myMap =
  7. {{ 1, "One"},
  8. {2, "Two"},
  9. {3, "Three"},
  10. {7, "Seven"}};
  11.  
  12. auto i = myMap.upper_bound(6);
  13. std::cout << (--i)->first << '\n';
  14. }
Success #stdin #stdout 0s 2964KB
stdin
Standard input is empty
stdout
3