Connecting 4 HELP

Alright, so I just started with c++; I'm using a book called "jumping into c++" and in chapter 14 they talk about pointers, pointers to pointers, etc. That's why I'm trying to make a connect 4 using pointers (I'm sure I'm complicating it a lot, but whatever) the problem is that I don't know how to scan the board to see if someone has won or not. I've tried to scan the whole board but the game just crashed; so... does someone know how could I check if someone has connected 4?

NOTE: The void called scan_move() it's supposed to be the function that detects if someone has won

Thanks!! Here's the code:

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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  #include <iostream>
#include <stdlib.h>

using namespace std;
 int** p_p_board;
 int y = 0;
 bool player_1 = true;
 bool moves = false;
 bool game_won = false;
 string name, player1, player2;
 void indicate_player()
 {
     if (player_1 == true)
    {
        name = player1;
    }
    else if (player_1 == false)
    {
        name = player2;
    }
 }

int create_board(int h, int w)
{
    p_p_board = new int* [h];
   for (int i = 0; i < h; i++)
   {
       p_p_board [i] = new int[w];
   }
   for (int i = 0; i < h; i++)
   {
       for (int j = 0; j < w; j++)
       {
           p_p_board [i][j] = 0;
       }
   }
}
void show_board(int h, int w)
{
    for (int i = 0; i < h; i++)
    {
        cout<< "\n";
        for (int j = 0; j < w; j++)
        {
            cout<< p_p_board [i][j]<< " ";
        }
    }
}
void player_move(int x, int h)
{
    for (int i = h; i--; i < 0)
    {
        if (moves == false)
        {
           if (p_p_board[i][x] == 0)
        {
            moves = true;
            y = i;
            if (player_1 == true)
            {
              p_p_board[i][x] = 1;
              player_1 = false;
            }
            else if (player_1 == false)
            {
                p_p_board[i][x] = 2;
                player_1 = true;
            }
        }
        }
    }
    moves = false;
}

void scan_move(int y, int x)
{

}
int main()
{
    cout << "What's your name, player 1? ";
    cin>>player1;
    cout << "\nWhat's your name, player 2? ";
    cin>>player2;
    system("CLS");

    int width, height, x;
    cout << "Please indicate the width: ";
    cin >>width;
    cout << "\nPlease indicate the height:";
    cin >>height;
    system("CLS");

   create_board(height, width);
   cout<< "THIS IS THE BOARD:\n";

   while (game_won == false)
   {
        indicate_player();
        show_board(height, width);
        cout<< "\n\n"<<name<<", in what column do you wish to put the coin?:";
        cin>>x;
        player_move(x, height);
        cout<<"\n\n\nthis is x:"<<x<<"\nThis is y:"<<y;
        scan_move(y, x);
        system("CLS");
   }
delete p_p_board;
}
Duplicate thread:

http://www.cplusplus.com/forum/beginner/144262/

Please don't do that.
Topic archived. No new replies allowed.