Connect 4 game won't end

My connect 4 game will not end when it hits 4 in a row. It shows the board, allows the user to pick a number and places the piece and updates the board. But it will not end when it hits 4 in a row. Can someone help me figure out the logic error?
The checkwin section is placed below, (sorry if the format is weird, I copied and pasted from visual studios)
[code]
int checkwin(int player)
{
char mark = (player == 1) ? 'X' : 'O';
int Tcord[2] = { 0, 0 };
for (int i = 0; i < (6 * 7); i++)
{
int hits = 0;
if (square[i] == mark)
{
Tcord[0] = i / 7;
Tcord[1] = i % 7;
for (int i = 1; i < 4; i++)
{
if (square[(Tcord[0] + 0) * width + (Tcord[1] + i)] == mark)
{
hits++;
cout << 1 << hits << endl;
}
else
{
hits = 0;
break;
}
}
if (hits == 3)
{
return 1;
}
for (int i = 1; i < 4; i++)
{
if (square[(Tcord[0] + i) * width + (Tcord[1] + i)] == mark)
{
hits++;
cout << 2 << hits << endl;
}
else
{
hits = 0;
break;
}
}
if (hits == 3)
{
return 1;
}
for (int i = 1; i < 4; i++)
{
if (square[(Tcord[0] + i) * width + (Tcord[1] + 0)] == mark)
{
hits++;
}
else
{
hits = 0;
break;
}
}
if (hits == 3)
{
return 1;
}
for (int i = 1; i < 4; i++)
{
if (square[(Tcord[0] + i) * width + (Tcord[1] - i)] == mark)
{
hits++;
cout << 4 << hits << endl;
}
else
{
hits = 0;
break;
}
}
if (hits == 3)
{
return 1;
}
}
}
int counter = 0;
for (int i = 0; i < (6 * 7); i++)
{
if (square[i] == 'X' || square[i] == 'O')
{
counter++;
}
}
if (counter == 42)
{
return 0;
}
return -1;
}
Topic archived. No new replies allowed.