From 95f56b550940265c2b4971e8ca92e0041bc77cbe Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 6 Dec 2025 00:53:36 -0500 Subject: [PATCH] JEU FONCTIONNEL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --- main.cpp | 18 ++++++++++-------- mesFonctions.cpp | 19 ++++++++++++++++++- mesFonctions.h | 4 ++++ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/main.cpp b/main.cpp index 079d986..1c51810 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,15 @@ DATE : 17 novembre 2025 BUT : Rassemble les appels de fonction de Taxon ====================================*/ +/* + + + +SCOREBOARD pour fichier en écriture + + +*/ + //Librairies #include #include @@ -44,14 +53,7 @@ int main() { curseur(true); system("cls"); - if (effectuerTour()) { - // Victoire - cout << "VICTOIRE !!!"; - } - else { - // Défaite - cout << "DEFAITE !!!"; - } + effectuerTour(); break; case '2': diff --git a/mesFonctions.cpp b/mesFonctions.cpp index 09c9118..ac00a08 100644 --- a/mesFonctions.cpp +++ b/mesFonctions.cpp @@ -142,7 +142,6 @@ bool effectuerTour() { string lettrePlayer; do { - cout << "Le mot est " << motRandom << endl; // TODO: RETIRER SA cout << setw(69) << "Tentative des mots de " << nbLettre << " #" << nbTentative + 1 << endl; cout << setw(69) << "Saisir votre mot : "; cin >> motPlayer; //TODO: mettre tolower string (boucle) @@ -172,6 +171,7 @@ bool effectuerTour() if (nbBonneLettre == nbLettre) { + afficherVictoire(motRandom); return true; } cout << endl; @@ -182,6 +182,7 @@ bool effectuerTour() nbTentative--; } } + afficherDefaite(motRandom); return false; } @@ -287,6 +288,22 @@ void printLettre(fstream& monFlux, int positionLettre) SetConsoleTextAttribute(hconsole, 15); } +// Affichage victoire et défaite +void afficherVictoire(string motRandom) { + system("cls"); + cout << "Felicitations, vous avez gagnez ! Le mot etais bien \"" << motRandom << "\" :D"; + system("PAUSE>NUL"); +} + +void afficherDefaite(string motRandom) { + system("cls"); + cout << "Dommage ! Meilleur chance la prochaine fois..." + << endl + << "Pour votre information, le mot a deviner etais \"" << motRandom << "\"."; + system("PAUSE>NUL"); +} + + /*==================================== 2 - OPTIONS ====================================*/ diff --git a/mesFonctions.h b/mesFonctions.h index b2ce0eb..bbcd471 100644 --- a/mesFonctions.h +++ b/mesFonctions.h @@ -38,6 +38,10 @@ int lettreDansMot(string motRandom, string motPlayer, int nbLettre, int i); void afficherMotPlayer(string lettrePlayer, int positionLettre); void printLettre(fstream& monFlux, int positionLettre); +// Messages victoire et défaite +void afficherVictoire(string motRandom); +void afficherDefaite(string motRandom); + /*==================================== 2 - OPTIONS ====================================*/