This commit is contained in:
fl3ka 2024-05-12 14:49:34 +02:00
parent 926043d8c0
commit 4cbbfb47b3

View File

@ -27,11 +27,14 @@ void checkWin(char board[3][3], char player) {
cout << board[0][0] << " WON!" << endl;} cout << board[0][0] << " WON!" << endl;}
if(board[2][0] == player && board[1][1] == player && board[0][2] == player){ if(board[2][0] == player && board[1][1] == player && board[0][2] == player){
cout << board[2][0] << " WON!" << endl;} cout << board[2][0] << " WON!" << endl;}
} }
int main(){ int main(){
int i;
int row; int row;
int col; int col;
char player = 'X'; char player = 'X';
@ -43,7 +46,7 @@ char board[3][3] = { { ' ', ' ', ' ' },
cout << "Welcome to Tic-Tac-Toe!\n"; cout << "Welcome to Tic-Tac-Toe!\n";
for(int i=0; i<8; i++){ for(i=0; i<9; i++){
drawBoard(board); drawBoard(board);
@ -75,9 +78,11 @@ for(int i=0; i<8; i++){
continue; continue;
} }
} }
cout << "It's Draw!" << endl; if(i = 9){
cout << "It's Draw\n";
drawBoard(board);
}
return 0; return 0;
} }