title: C++ First letter of every word must be uppercased
body: <p>I'm a student and new to programming</p>
  <p>I'm trying to make every first letter of every word uppercased and the rest lowercased.</p>
  <p>The output currently is that only the first word is being printed even though I'm typing in 2 or more words.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  
  using namespace std;
  
  int main()
  {
      int i;
      char str[100];
      char rev;
      int len = 0;
  
      cout &lt;&lt; &quot;Enter a string: &quot;;
      cin &gt;&gt; str;
      
      len = strlen(str);
      
      for (i = 0; i &lt; len; i++)
      {
          if (i == 0)
          {
              str[i] = toupper(str[i]);
          }
          else
          {
              str[i] = tolower(str[i]);
          }
          cout &lt;&lt; str[i];
      }
  }
  </code></pre>