Change in a Cell

kkkk
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
double hot_plate[ARRAY_SIZE][ARRAY_SIZE];
double hot_plate_prev[ARRAY_SIZE][ARRAY_SIZE];

while (true)
{
    // This is your code
    for (int i = 0; i < ARRAY_SIZE; i++)
    {
        for (int j = 0; j < ARRAY_SIZE; j++)
        {
            if (i > 0 && i < ARRAY_SIZE - 1 && j > 0 && j < ARRAY_SIZE - 1)
            {
                hot_plate[i][j] = sum_cell(hot_plate, j, i);
            }
        }
    }
    
    bool theSame = true;
    for (int i = 0; i < ARRAY_SIZE; i++)
    {
        for (int j = 0; j < ARRAY_SIZE; j++)
        {
            if (abs(hot_plate[i][j] - hot_plate_prev[i][j]) < 0.1)
            {
                theSame = false;
            }
            hot_plate_prev[i][j] = hot_plate[i][j];
        }
    }
    
    if (!theSame) break;
}
Topic archived. No new replies allowed.