title: Why does this not print anything
body: <p>So I have this, and if I comment out the bottom part, from <code>int count = 0;</code> to <code>return 0;</code> it will print, but in this case, nothing prints out. Even adding <code>cout &lt;&lt; "Test"</code> in the beginning does nothing. It all compiles fine though.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cctype&gt;
  using namespace std;
  
  int main()
  {
      string text = "Smith, where Jones had had \"had had\", had had \"had\". \"Had had\" had had the examiners' approval.";
  
      string search = "had";
  
      int length = (int) text.length();
  
      for(int i = 0; i &lt; length; i++)
      {
          text [i] = tolower(text [i]);
      }
  
      cout &lt;&lt; text;
  
      int count = 0;
      for (int index = 0; (index = text.find(search)) != string::npos; index += search.length()) {
          count++;
          }
  
      cout &lt;&lt; "There are " &lt;&lt; count &lt;&lt; " occurences of \"" &lt;&lt; search &lt;&lt; "\".\n"; 
      return 0;
  }
  </code></pre>