JEU FONCTIONNEL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This commit is contained in:
2025-12-06 00:53:36 -05:00
parent f6d1303095
commit 95f56b5509
3 changed files with 32 additions and 9 deletions

View File

@@ -6,6 +6,15 @@ DATE : 17 novembre 2025
BUT : Rassemble les appels de fonction de Taxon BUT : Rassemble les appels de fonction de Taxon
====================================*/ ====================================*/
/*
SCOREBOARD pour fichier en <20>criture
*/
//Librairies //Librairies
#include <iostream> #include <iostream>
#include <conio.h> #include <conio.h>
@@ -44,14 +53,7 @@ int main() {
curseur(true); curseur(true);
system("cls"); system("cls");
if (effectuerTour()) { effectuerTour();
// Victoire
cout << "VICTOIRE !!!";
}
else {
// D<>faite
cout << "DEFAITE !!!";
}
break; break;
case '2': case '2':

View File

@@ -142,7 +142,6 @@ bool effectuerTour()
{ {
string lettrePlayer; string lettrePlayer;
do { do {
cout << "Le mot est " << motRandom << endl; // TODO: RETIRER SA
cout << setw(69) << "Tentative des mots de " << nbLettre << " #" << nbTentative + 1 << endl; cout << setw(69) << "Tentative des mots de " << nbLettre << " #" << nbTentative + 1 << endl;
cout << setw(69) << "Saisir votre mot : "; cout << setw(69) << "Saisir votre mot : ";
cin >> motPlayer; //TODO: mettre tolower string (boucle) cin >> motPlayer; //TODO: mettre tolower string (boucle)
@@ -172,6 +171,7 @@ bool effectuerTour()
if (nbBonneLettre == nbLettre) if (nbBonneLettre == nbLettre)
{ {
afficherVictoire(motRandom);
return true; return true;
} }
cout << endl; cout << endl;
@@ -182,6 +182,7 @@ bool effectuerTour()
nbTentative--; nbTentative--;
} }
} }
afficherDefaite(motRandom);
return false; return false;
} }
@@ -287,6 +288,22 @@ void printLettre(fstream& monFlux, int positionLettre)
SetConsoleTextAttribute(hconsole, 15); 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 2 - OPTIONS
====================================*/ ====================================*/

View File

@@ -38,6 +38,10 @@ int lettreDansMot(string motRandom, string motPlayer, int nbLettre, int i);
void afficherMotPlayer(string lettrePlayer, int positionLettre); void afficherMotPlayer(string lettrePlayer, int positionLettre);
void printLettre(fstream& monFlux, int positionLettre); void printLettre(fstream& monFlux, int positionLettre);
// Messages victoire et d<>faite
void afficherVictoire(string motRandom);
void afficherDefaite(string motRandom);
/*==================================== /*====================================
2 - OPTIONS 2 - OPTIONS
====================================*/ ====================================*/