Can someone explain why a value gets incremented when "++" is used for comparison? : <p>This may already be a question out there, but with the lack of specific key terms, it's a bit hard to search for. Just looking for more insight on this topic.</p>

<p>Right now, I'm working in C++ and wondering why my value is replaced with an incremented value when I compare using "++". </p>

<p>So here, we print 14 times (numbers 1-14).</p>

<pre><code>int i = 0, x = 0;
while (x &lt; 30) {
    x++;
    if (13 &lt; i++) break;
    cout &lt;&lt; i &lt;&lt; endl;
}
</code></pre>

<p>Here, we print 30 zeros.</p>

<pre><code>int i = 0, x = 0;
while (x &lt; 30) {
    x++;
    if (13 &lt; i+1) break;
    cout &lt;&lt; i &lt;&lt; endl;
}
</code></pre>

<p>And this just plain doesn't work. (I wanted to try because <code>i++</code> = <code>i=i+1</code>).</p>

<pre><code>int i = 0, x = 0;
while (x &lt; 30) {
    x++;
    if (13 &lt; i=i+1) break;
    cout &lt;&lt; i &lt;&lt; endl;
}
</code></pre>
