trying connect 4 but having loop problems

Hi, I'm trying t his code out....

Will someone tell me why it isn't working?
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
#include <iostream>
#include <string>
using namespace std;

int knock = 6;
class makeGame
{
private:
int gameGrid [42];
int choice1;
int choice2;
public:
void setChoice(int n, int p){if(p > 0) {choice2 = n;} else {choice1 = n;}}
void setGame();
};




int main()
{
makeGame o;
o.setGame();
return 0;
}
void makeGame::setGame()
{
cout << "1234567";
cout << endl;
for(int b = 0; b < 42; b++)
{
gameGrid[b] = 0;
cout << gameGrid[b];
if(knock == b)
{
cout << endl;
knock += knock + 1;
}
}
}


this is the output

1234567
0000000
0000000
00000000000000
00000000000000


should be like this

1234567
0000000
0000000
0000000
0000000
0000000
0000000
Last edited on
nvm i figured it out after i took a piss
Topic archived. No new replies allowed.