Enregistrement de mes dernieres modifications

This commit is contained in:
2025-12-06 00:03:04 -05:00
parent 24cd682bdb
commit fa623541ff
4 changed files with 21 additions and 5 deletions

View File

@@ -42,8 +42,14 @@ 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

@@ -123,9 +123,10 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g
return mot; return mot;
} }
void effectuerTour() bool effectuerTour()
{ {
string motRandom; string motRandom;
int nbBonneLettre = 0;
if (nbLettre == 3) { if (nbLettre == 3) {
motRandom = choisirMot("Mots/mot3lettres.txt"); motRandom = choisirMot("Mots/mot3lettres.txt");
} }
@@ -155,6 +156,7 @@ void effectuerTour()
if (lettreDansMot(motRandom, motPlayer, nbLettre, i) == BONNE_PLACE) { if (lettreDansMot(motRandom, motPlayer, nbLettre, i) == BONNE_PLACE) {
lettrePlayer = motPlayer[i]; lettrePlayer = motPlayer[i];
afficherMotPlayer(lettrePlayer, BONNE_PLACE); afficherMotPlayer(lettrePlayer, BONNE_PLACE);
nbBonneLettre++;
} }
else if (lettreDansMot(motRandom, motPlayer, nbLettre, i) == MAUVAIS_PLACE) { else if (lettreDansMot(motRandom, motPlayer, nbLettre, i) == MAUVAIS_PLACE) {
lettrePlayer = motPlayer[i]; lettrePlayer = motPlayer[i];
@@ -173,6 +175,14 @@ void effectuerTour()
nbTentative--; nbTentative--;
} }
} }
if (nbBonneLettre == nbLettre)
{
return true;
}
else
{
return false;
}
} }

View File

@@ -31,7 +31,7 @@ int nombreLigneFichier(fstream& monFlux);
string choisirMot(string nomFichier); string choisirMot(string nomFichier);
string goToLine(fstream& monFlux, int numeroLigne); string goToLine(fstream& monFlux, int numeroLigne);
void effectuerTour(); bool effectuerTour();
bool dansListe(string motPlayer); bool dansListe(string motPlayer);
bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne); bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne);
int lettreDansMot(string motRandom, string motPlayer, int nbLettre, int i); int lettreDansMot(string motRandom, string motPlayer, int nbLettre, int i);