This is the code for the won() function.
bool won(void)
{
int counter=1;
for(int i=0;i<d;i++)
{
for(int j=0;j<d;j++)
{
if (board[d-1][d-1]!=0 || (board[i][j]!=counter))
{
return false;
}
else if (counter<(d*d)-1)
{
counter++;
}
}
}
return true;
}
Everytime I use the ./fifteen 3 < ~cs50/pset3/3x3.txt command when the won function should return ftw, it instead prompts for an input and returns illegal move