fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7. std::vector<double> vec;
  8. for(double x{0.0}; x < 10.0 + 0.5; x += 1.0) vec.push_back(x);
  9. auto it = std::upper_bound( vec.begin(), vec.end(), 5.5 );
  10. if( it != vec.end() )
  11. std::cout << "found:" << *it << std::endl;
  12.  
  13. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
found:6