Hi guys, i'm currently trying to create connect four in C++, however i'm having a little trouble discerning why my win check going vertical declares a winner despite four in a row not being played, but simply four of the same counter in that column in any order, is declared a winner. Any help is greatly appreciated for my little problem.
//vertical win for player one
do
{
if (gameboard[wrow][col] == 'X')
{
colwin++;
}
wrow++
}
while (wrow<7 && colwin<4);
if (colwin==4)
{
cout<<name1<<" has won!"<<endl;
winner=true;
}
// vertical win for player two
do
{
if (gameboard[wrow2][col] == 'O')
{
colwin2++;
}
wrow2++;
}
while (wrow2<7 && colwin2<4);
if (colwin2==4)
{
cout<<name2<<" has won!"<<endl;
winner=true;