From 078a2516e262bfe3dacf9522e04d1869826ea5fd Mon Sep 17 00:00:00 2001 From: Sunny Date: Wed, 26 Nov 2025 09:35:01 -0500 Subject: [PATCH] fonction init --- TicTacToe/fonctions.cpp | 18 ++++++++++++------ TicTacToe/main.cpp | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/TicTacToe/fonctions.cpp b/TicTacToe/fonctions.cpp index eedce18..d693e00 100644 --- a/TicTacToe/fonctions.cpp +++ b/TicTacToe/fonctions.cpp @@ -87,7 +87,11 @@ void afficherImageMenu(std::fstream& monFlux) { //Général (plusieurs options) void initTab(string grid[][LARGTIC]) { - + for (int i = 0; i < LARGTIC; i++) { + for (int j = 0; j < LARGTIC; i++) { + grid[i][j] = " "; + } + } } void afficherImageTableau(std::string grid[][LARGTIC]) { @@ -269,10 +273,12 @@ void jeuUnJoueur(string grid[][LARGTIC]) { tourJoueur(grid, 1); gagnant = 1; fin = verifFinMatch(grid); - tourOrdi(grid); - gagnant = 2; - system("PAUSE>0"); - fin = verifFinMatch(grid); + if (fin != true) { + tourOrdi(grid); + gagnant = 2; + system("PAUSE>0"); + fin = verifFinMatch(grid); + } } while (fin != true); afficherFinMatch(grid, gagnant, nbJoueurs); } @@ -296,7 +302,7 @@ void jeuDeuxJoueurs(string grid[][LARGTIC]) { int gagnant; int nbJoueurs = 2; - cout << endl << "Deux joueurs a ete choisi. Les tours seront l'un a la suite de l'autre." << endl << endl; + cout << "\nDeux joueurs a ete choisi. Les tours seront l'un a la suite de l'autre.\n\n"; do { tourJoueur(grid, 1); diff --git a/TicTacToe/main.cpp b/TicTacToe/main.cpp index c444faf..118c197 100644 --- a/TicTacToe/main.cpp +++ b/TicTacToe/main.cpp @@ -17,7 +17,7 @@ int main() { srand(time(NULL)); char choix; - string grid[LARGTIC][LARGTIC] = { " ", " ", " "," ", " ", " ", " ", " ", " " }; + string grid[LARGTIC][LARGTIC] = {" ", " ", " "," ", " ", " ", " ", " ", " "}; do { initTab(grid);