From 7b6611065c6dda32ac091e8392ed60ddb065773d Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 5 Dec 2025 19:10:00 -0500 Subject: [PATCH] =?UTF-8?q?UPDATE=20MAJEUR=20:=20Int=C3=A9gration=20des=20?= =?UTF-8?q?mots=20de=204=20lettres.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0 | 2 +- Mots/mot4lettres.txt | 74 +++++++++++++++++++++++++++++++++++++++++++ Taxon.vcxproj | 1 + Taxon.vcxproj.filters | 12 +++++-- main.cpp | 4 ++- mesFonctions.cpp | 68 +++++++++++++++++++++++++++++++-------- mesFonctions.h | 3 +- 7 files changed, 145 insertions(+), 19 deletions(-) create mode 100644 Mots/mot4lettres.txt diff --git a/0 b/0 index 4588032..d7619da 100644 --- a/0 +++ b/0 @@ -1 +1 @@ -Appuyez sur une touche pour continuer... +Appuyez sur une touche pour continuer... \ No newline at end of file diff --git a/Mots/mot4lettres.txt b/Mots/mot4lettres.txt new file mode 100644 index 0000000..e33ef42 --- /dev/null +++ b/Mots/mot4lettres.txt @@ -0,0 +1,74 @@ +abdo +abri +adon +afin +agir +aide +aigu +aile +aire +aise +allo +alma +alpe +alte +alto +amer +anal +ange +anti +anus +aria +arme +aube +auge +aura +auto +aval +avec +axer +azur +bave +bide +bien +bise +bite +bleu +blog +bobo +boom +boss +bouc +boue +boxe +bras +bref +bric +brin +brou +brun +buse +caca +cage +camp +case +cave +ceci +cent +cerf +chat +chef +cher +chez +chic +ciel +clou +club +cote +coup +cour +cout +crac +cran +cric +cube \ No newline at end of file diff --git a/Taxon.vcxproj b/Taxon.vcxproj index 4976f1a..de29914 100644 --- a/Taxon.vcxproj +++ b/Taxon.vcxproj @@ -162,6 +162,7 @@ + diff --git a/Taxon.vcxproj.filters b/Taxon.vcxproj.filters index be8209b..a6bd0a4 100644 --- a/Taxon.vcxproj.filters +++ b/Taxon.vcxproj.filters @@ -19,6 +19,9 @@ {df2ed3d4-f003-4ddf-afbb-9da73c17e1f3} + + {e4854bf8-7fba-4be2-912e-80d765ca577e} + @@ -52,9 +55,6 @@ Fichiers de ressources\AfficheMenu - - Fichiers de ressources - Fichiers de ressources\Alphabet @@ -133,6 +133,12 @@ Fichiers de ressources\Alphabet + + Fichiers de ressources\Mots + + + Fichiers de ressources\Mots + diff --git a/main.cpp b/main.cpp index 841986e..92b436d 100644 --- a/main.cpp +++ b/main.cpp @@ -24,9 +24,10 @@ int main() { bool quitter = false; //Quitter le jeu int nbMot3lettre = 15; //Nombre de mot présent dans le fichier - int nbLettre = 3; + int nbLettre = 4; string motRandom; // Mot random const int NOMBREMOT3LETTRE = 101; + const int NOMBREMOT4LETTRE = 74; int nbEssai = 6; while (quitter == false) { @@ -52,6 +53,7 @@ int main() { curseur(true); system("cls"); choixNbEssai(); + choixLongeurMot(); break; case '3': diff --git a/mesFonctions.cpp b/mesFonctions.cpp index 66ac62c..6883557 100644 --- a/mesFonctions.cpp +++ b/mesFonctions.cpp @@ -25,7 +25,9 @@ using namespace std::chrono_literals; const int BONNE_PLACE = 1, MAUVAIS_PLACE = 2, PAS_LA = 3; extern const int NOMBREMOT3LETTRE = 101; +extern const int NOMBREMOT4LETTRE = 74; extern int nbEssai = 6; +extern int nbLettre = 4; /*==================================== MENU @@ -110,8 +112,13 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g void effectuerTour(int nbLettre) { - - string motRandom = choisirMot("Mots/mot3lettres.txt", NOMBREMOT3LETTRE); + string motRandom; + if (nbLettre == 3) { + motRandom = choisirMot("Mots/mot3lettres.txt", NOMBREMOT3LETTRE); + } + else if (nbLettre == 4) { + motRandom = choisirMot("Mots/mot4lettres.txt", NOMBREMOT4LETTRE); + } cout << setw(83) << "=============================================\n"; @@ -157,18 +164,30 @@ void effectuerTour(int nbLettre) bool dansListe(string motPlayer) { - fstream monFlux; - ouvrirFichier(monFlux, "Mots/mot3lettres.txt"); - string mot; - for (int i = 0; i < NOMBREMOT3LETTRE; i++) { - getline(monFlux, mot); + if (nbLettre == 3) { + ouvrirFichier(monFlux, "Mots/mot3lettres.txt"); + for (int i = 0; i < NOMBREMOT3LETTRE; i++) { + getline(monFlux, mot); - if (motPlayer == mot) - { - fermerFichier(monFlux); - return true; + if (motPlayer == mot) + { + fermerFichier(monFlux); + return true; + } + } + } + else if (nbLettre == 4) { + ouvrirFichier(monFlux, "Mots/mot4lettres.txt"); + for (int i = 0; i < NOMBREMOT4LETTRE; i++) { + getline(monFlux, mot); + + if (motPlayer == mot) + { + fermerFichier(monFlux); + return true; + } } } fermerFichier(monFlux); @@ -254,11 +273,34 @@ void printLettre(fstream& monFlux, int positionLettre) /*==================================== 2 - OPTIONS ====================================*/ -void choixNbEssai() { +void choixNbEssai() +{ cout << "Veuillez choisir le nombre de tentative que vous souhaitez avoir." << "\nPar defaut, le nombre de tentative est a 6." << endl << "Nombre de tentative : "; cin >> nbEssai; - cout << "Vous avez choisi d'avoir " << nbEssai << " tentatives."; + cout << "Vous avez choisi d'avoir " << nbEssai << " tentatives." + << endl + << endl; +} + +void choixLongeurMot() { + cout << "Veuillez choisir la longueur des mots a deviner." + << "\nPar defaut, la longeur est a 3 lettres." + << "\n***Pour le moment, uniquement les mots de 3 et de 4 lettres fonctionnent.***" + << endl + << "Longeur des mots : "; + cin >> nbLettre; + if (nbLettre == 3 || nbLettre == 4) { + cout << "Vous avez choisi d'avoir " << nbLettre << " lettres dans les mots a trouver." + << endl + << endl; + } + else { + nbLettre = 3; + cout << "Choix non disponible, nous avons choisis pour vous. Les mots auront 3 lettres." + << endl + << endl; + } } \ No newline at end of file diff --git a/mesFonctions.h b/mesFonctions.h index e22e175..577a913 100644 --- a/mesFonctions.h +++ b/mesFonctions.h @@ -39,4 +39,5 @@ void printLettre(fstream& monFlux, int positionLettre); /*==================================== 2 - OPTIONS ====================================*/ -void choixNbEssai(); \ No newline at end of file +void choixNbEssai(); +void choixLongeurMot(); \ No newline at end of file