title: vector<string>::iterator - how to find position of an element
body: <p>I am using the following code to find a string in an <code>std::vector</code> of <code>string</code> type. But how to return the position of particular element?</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main() {
      vector&lt;string&gt; vec;
      vector&lt;string&gt;::iterator it;
  
      vec.push_back("H");
      vec.push_back("i");
      vec.push_back("g");
      vec.push_back("h");
      vec.push_back("l");
      vec.push_back("a");
      vec.push_back("n");
      vec.push_back("d");
      vec.push_back("e");
      vec.push_back("r");
  
      it=find(vec.begin(),vec.end(),"r");
      //it++;
  
      if(it!=vec.end()){
          cout&lt;&lt;"FOUND AT : "&lt;&lt;*it&lt;&lt;endl;
      }
      else{
          cout&lt;&lt;"NOT FOUND"&lt;&lt;endl;
      }
      return 0;
  }
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <p><code>FOUND AT : r</code></p>
  
  <p><strong>Expected Output:</strong></p>
  
  <p><code>FOUND AT : 9</code></p>