Upload files to "/"

This commit is contained in:
fl3ka 2024-05-12 11:56:22 +00:00
parent 7d1ae201b3
commit 1918da4073

View File

@ -29,25 +29,6 @@ void checkWin(char board[3][3], char player) {
cout << board[2][0] << " WON!" << endl;} cout << board[2][0] << " WON!" << endl;}
} }
void chooseCaR(int row, int col, char player){
cout << "Player " << player << " choose a row (1-3): ";
cin >> row;
while(row > 3){
cout << "Invalid input\n";
cout << "Choose a row (1-3): \n";
cin >> row;
}
cout << "Choose a column (1-3): ";
cin >> col;
while(col > 3){
cout << "Invalid input\n";
cout << "Choose a column (1-3): \n";
cin >> col;
}
}
int main(){ int main(){
@ -65,11 +46,23 @@ cout << "Welcome to Tic-Tac-Toe!\n";
for(int i=0; i<8; i++){ for(int i=0; i<8; i++){
drawBoard(board); drawBoard(board);
chooseCaR(row, col, player);
if(board[col-1][row-1] == 'X' || 'O') cout << "Player " << player << " choose a row (1-3): ";
cout << "Place taken\n"; cin >> row;
else while(row > 3){
cout << "Invalid input\n";
cout << "Choose a row (1-3): \n";
cin >> row;
}
cout << "Choose a column (1-3): ";
cin >> col;
while(col > 3){
cout << "Invalid input\n";
cout << "Choose a column (1-3): \n";
cin >> col;
}
board[col-1][row-1] = player; board[col-1][row-1] = player;
checkWin(board, player); checkWin(board, player);
@ -81,3 +74,5 @@ for(int i=0; i<8; i++){
cout << "It's Draw!" << endl; cout << "It's Draw!" << endl;
} }