What is the previous value in this loop?
<p>Here is part of my code. The rest is just the function definitions. I have an array of 20 x 20 that records the temperature of a plate. I need to reiterate through a loop until no cell in the array changes more than 0.1 degree (I refresh the values through every iteration) How would you monitor the largest change for any cell in an array in order to determine when to stop iterating? Right now I have tried this, but it doesn't output correctly. I believe it is because I am incorrectly defining my previous one to compare the current one with.</p>

<pre><code>while (true)
{
    bool update = false;
    for (int a = 1; a &lt; array_size -1; a++)
    {
        for (int b = 1; b &lt; array_size -1; b++)
        {             
            hot_plate[a][b] = sum_cell(hot_plate, a, b);

        }
    } 

    for (int a = 1; a &lt; array_size-1; a++)
    {
        for (int b = 1; b &lt; array_size-1; b++)
        {
            hot_plate_next[a][b]=sum_cell(hot_plate_next, a,b);
            if (abs(hot_plate_next[a][b] - hot_plate[a][b]) &gt; 0.1)
            {
                update = true;
            }
            hot_plate_next[a][b] = hot_plate[a][b];
            cout &lt;&lt; hot_plate[a][b] &lt;&lt; " ";
        }  
    }

    if (!update) {
        break;
    }
}
</code></pre>
