This is a tic-tac-toe game. The problem is if the last row is filled, the game prints "Draw" and ends, This is supposed to happen only if all the cells are filled. What's my fault?!
The break statement terminates the execution of the nearest enclosing
do
,for
,switch
, orwhile
statement in which it appears. Control passes to the statement that follows the terminated statement.
When you set your empty_cell variable you use a break in a nested loop. Doing this you exit only from the first loop and continue in the second. this is causing your issue.
Set your flag out of the loop and change it only if needed.