From 15616971d852f5847c14e68f062d716ecbb74a51 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 5 Dec 2025 09:52:53 -0500 Subject: [PATCH] changement de merde --- 0 | 2 +- mesFonctions.cpp | 20 +++++++++++--------- mesFonctions.h | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/0 b/0 index 4588032..ba64bff 100644 --- a/0 +++ b/0 @@ -1 +1 @@ -Appuyez sur une touche pour continuer... +Press any key to continue . . . \ No newline at end of file diff --git a/mesFonctions.cpp b/mesFonctions.cpp index fb81584..8a5cf14 100644 --- a/mesFonctions.cpp +++ b/mesFonctions.cpp @@ -128,22 +128,22 @@ void effectuerTour(int nbLettre) for (int i = 0; i < nbLettre; i++) { - if (motRandom[i] == motPlayer[i]) { + if (lettreDansMot(motRandom, motPlayer, nbLettre) == 1) { SetConsoleTextAttribute(hconsole, 2);//mettre la lettre en vert cout << motPlayer[i]; SetConsoleTextAttribute(hconsole, 15);//remettre le texte en blanc } - else if (lettreDansMot(motRandom, motPlayer, nbLettre)) { + else if (lettreDansMot(motRandom, motPlayer, nbLettre) == 2) { - SetConsoleTextAttribute(hconsole, 6);//mettre la lettre en vert + SetConsoleTextAttribute(hconsole, 6);//mettre la lettre en jaune cout << motPlayer[i]; SetConsoleTextAttribute(hconsole, 15);//remettre le texte en blanc } else { - SetConsoleTextAttribute(hconsole, 8);//mettre la lettre en vert + SetConsoleTextAttribute(hconsole, 8);//mettre la lettre en gris cout << motPlayer[i]; SetConsoleTextAttribute(hconsole, 15);//remettre le texte en blanc } @@ -179,18 +179,20 @@ bool dansListe(string motPlayer) { } -bool lettreDansMot(string motRandom, string motPlayer, int nbLettre) { +int lettreDansMot(string motRandom, string motPlayer, int nbLettre) { for (int i = 0; i < nbLettre; i++) { for (int k = 0; k < nbLettre; k++) { - if ((motRandom[i] == motPlayer[k]) && (motRandom[i] != motPlayer[i])) { - return true; + + if (motRandom[i] == motPlayer[k] && i == k) { + return 1; } - else { - return false; + else if ((motRandom[i] == motPlayer[k]) && i != k) { + return 2; } } } + return 3; } diff --git a/mesFonctions.h b/mesFonctions.h index 65e2a7e..1a07e6f 100644 --- a/mesFonctions.h +++ b/mesFonctions.h @@ -35,4 +35,4 @@ string goToLine(fstream& monFlux, int numeroLigne); void effectuerTour(int nbLettre); bool dansListe(string motPlayer); bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne); -bool lettreDansMot(string motRandom, string motPlayer, int nbLettre); \ No newline at end of file +int lettreDansMot(string motRandom, string motPlayer, int nbLettre); \ No newline at end of file