Compiler Error Help

EDIT : Figured it out. Wrong spelling on one of them.

So I have 2 void functions. The first void function compiles without error but the second one doesn't. The second one gives me an error that "incrimenter was not declared in this scope". It looks similar to me but then again I've been looking at lines of code for an hour straight.

Using codeblocks with GNU compiler(I think) and C++11 enabled.

Thanks,
Extreme112
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
void win_horizontal(int matrix[6][7], int &lastposvert, int &lastposhor, int &player_num, bool &winner_declared)
{
    int score = 0;
    int incrimenter = 0;

    while (lastposhor+incrimenter >= 0 && lastposhor+incrimenter <= 7)// Checks Right
    {
        if (matrix[lastposvert][lastposhor + incrimenter] == player_num)
        {
            score++;
            incrimenter++;
        }
        else
        {
            break;
        }
    }

    incrimenter = 0;

    while (lastposhor + incrimenter >= 0 && lastposhor + incrimenter <= 7) //Checks Left
    {
        if (matrix[lastposvert][(lastposhor-1) + incrimenter] == player_num)
        {
            score++;
            incrimenter--;
        }
        else
        {
            break;
        }
    }
    if (score >= 4)
    {
        winner_declared = true;
    }
}

//Check diagonally (/) for win condition
//To do this ,we must check up and right from origin and
//down and left from origin

void win_digonal(int matrix[6][7], int &last_pos_vert, int &last_pos_hor, int &player_num, bool &winner_declared)
{
    int score = 0;
    int incrimenter = 0;

    while (last_pos_vert - incrimenter >=0 && last_pos_hor + incrimeter <= 7)
    {
        if (matrix[last_pos_vert - incrimenter][last_pos_hor + incrimenter] == player_num) // Check up and right from origin
        {
            score++;
            incrimenter++;
        }
        else
        {
            break;
        }
    }

    incrimenter = 0;

}
Last edited on
Topic archived. No new replies allowed.