title: upper_bound and find giving different results
body: <p>I am new to STL and used <code>find()</code> and <code>upper_bound()</code> functions on vector to find the position of 6 . The code is given below </p>
  
  <pre><code>
  #include &lt;bits/stdc++.h&gt;
  
  using namespace std;
  
  int main()
  {
      vector&lt;int&gt; sam ={1,2,5,3,7,8,4,6};
      int f=upper_bound(sam.begin(), sam.end(), 6)- sam.begin();
  
      vector&lt;int&gt;::iterator it; 
      it =find (sam.begin(), sam.end(), 6);
      int d=it - sam.begin() ;
      cout&lt;&lt;d&lt;&lt;" "&lt;&lt;f&lt;&lt;endl;
  
      return 0;
  }
  
  </code></pre>
  
  <p>The output when you run the code is 7 4 ,while I expected it to be 7 7 .
  What am I doing wrong ?</p>