title: Delete strings in a vector
body: <p>I have a vector full of strings</p>
  
  <p>the vector consistentWords contains 4 strings</p>
  
  <ol>
  <li>dedf</li>
  <li>eedf</li>
  <li>fedf</li>
  <li>hedf</li>
  </ol>
  
  <p>Now I want to delete all the strings that words don't start with the letter d</p>
  
  <p>However it ends up just deleting eedf and hedf and the result I have left is</p>
  
  <ol>
  <li>dedf</li>
  <li>fedf</li>
  </ol>
  
  <p>My code:</p>
  
  <pre><code>    for(int q=0; q&lt;consistentWords.size(); q++)
      {
          string theCurrentWord = consistentWords[q];
          if(theCurrentWord[0] != 'd')
          {
              consistentWords.erase(consistentWords.begin()+q);
          }
      }
  </code></pre>
  
  <p>Any thoughts? I just can't see why it's not deleting all of the strings that don't start with d.</p>