Printing a value makes the program work?
<pre><code>#include &lt;iostream&gt;
#include &lt;cstdio&gt;

using namespace std;

bool numar(unsigned long long n)
{
    return (n &gt; 99) &amp;&amp; ((n % 100) == 25);
}

int main()
{
    freopen("numere.in", "r", stdin);
    freopen("numere.out", "w", stdout);

    int cnt = 0;

    unsigned long long n, a, Nblabla, N;

    while (scanf("%d", &amp;n) == 1)
    {
        if (numar(n))
        {
            a = (n - 25) / 100;

            cout &lt;&lt; a; // This son of a *****.

            for (N = 1; true; N++)
            {
                Nblabla = N * (N + 1);

                if (Nblabla &gt; a)
                    break;
                else if (Nblabla == a)
                {
                    cnt++;
                }
            }
        }
    }

    printf("%d", cnt);

    return 0;
}
</code></pre>

<p>Simply, if I comment that line (<code>cout &lt;&lt; a;</code>), the program stops working. If I leave it there, it works.<br>
I'm using Code::Blocks, GNU GCC.</p>

<p>This just checks if a number is the square of a number that ends with the digit <code>5</code>. (Base 10) (I am not allowed to use square roots)  </p>

<p>Before asking, no, this isn't homework. This is my submission to a subject of an online contest.  </p>

<p>Can anyone tell me why is this happening?  </p>
