string and int concatenation in C++
<pre><code>string words[5];
for (int i = 0; i &lt; 5; ++i) {
    words[i] = "word" + i;
}

for (int i = 0; i &lt; 5; ++i) {
    cout&lt;&lt;words[i]&lt;&lt;endl;
}
</code></pre>

<p>I expected result as :</p>

<pre><code>word1
.
.
word5
</code></pre>

<p>Bu it printed like this in console:</p>

<pre><code>word
ord
rd
d
</code></pre>

<p>Can someone tell me the reason for this. I am sure in java it will print as expected.</p>