fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7. int myints[] = {10,20,30,30,20,10,10,20};
  8. vector<int> v(myints, myints+8);
  9. sort(v.begin(), v.end());
  10.  
  11. vector<int>::iterator low, up;
  12. low = lower_bound(v.begin(), v.end(), 20);
  13. up = upper_bound(v.begin(), v.end(), 20);
  14.  
  15. cout << "low" << (low- v.begin()) << "\n";
  16. cout << "upper" << (up - v.begin()) << "\n";
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 2872KB
stdin
Standard input is empty
stdout
low3
upper6