This commit is contained in:
2025-11-28 10:16:48 -05:00
3 changed files with 18 additions and 8 deletions

View File

@@ -40,9 +40,9 @@ int main() {
delai(); delai();
curseur(true); curseur(true);
system("cls"); system("cls");
background(temp); //background(temp);
motRandom = choisirMot("Mots/mot3lettres.txt", nbMot3lettre);
afficherMenuJouer(); effectuerTour();
break; break;
case '2': case '2':

View File

@@ -95,6 +95,7 @@ string choisirMot(string nomFichier, int maximum) {//Choisi un mot al
fermerFichier(monFlux); fermerFichier(monFlux);
return motRandom; return motRandom;
} }
string goToLine(fstream& monFlux, int numeroLigne) {//g<>n<EFBFBD>re un nb al<61>atoire, et choisi une ligne associ<63> pour un mot al<61>atoire. renvoi le mot choisi string goToLine(fstream& monFlux, int numeroLigne) {//g<>n<EFBFBD>re un nb al<61>atoire, et choisi une ligne associ<63> pour un mot al<61>atoire. renvoi le mot choisi
string mot; string mot;
for (int i = 0; i < numeroLigne; i++) { for (int i = 0; i < numeroLigne; i++) {
@@ -103,11 +104,14 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g
return mot; return mot;
} }
void afficherMenuJouer() void effectuerTour()
{ {
string motRandom = choisirMot("Mots/mot3lettres.txt", 15);
cout << setw(83) << "=============================================\n"; cout << setw(83) << "=============================================\n";
string motPlayer; string motPlayer;
for (int nbTentative = 0; nbTentative < 6; nbTentative++) for (int nbTentative = 0; nbTentative < 6; nbTentative++)
{ {
do do
@@ -115,11 +119,15 @@ void afficherMenuJouer()
cout << setw(65) << "Tentative #" << nbTentative + 1 << endl; cout << setw(65) << "Tentative #" << nbTentative + 1 << endl;
cout << setw(69) << "Saisir votre mot : "; cout << setw(69) << "Saisir votre mot : ";
cin >> motPlayer; cin >> motPlayer;
} while (motPlayer.length() > 3); } while (motPlayer.length() == 3);
if (dansListe(motPlayer)) if (dansListe(motPlayer))
{ {
cout << "\na continue\n"; cout << "\nto continue\n";
//NE PAS EFFACER
//if (motRandom[0] == motPlayer[0])
//else if (motRandom[0] == motPlayer[1] || motPlayer[2])
} }
else else
{ {
@@ -145,11 +153,13 @@ bool dansListe(string motPlayer)
if (motPlayer == mot) if (motPlayer == mot)
{ {
fermerFichier(monFlux);
return true; return true;
} }
} }
return false;
fermerFichier(monFlux); fermerFichier(monFlux);
return false;
} }

View File

@@ -32,6 +32,6 @@ void backgroundDefault();
string choisirMot(string nomFichier, int maximum); string choisirMot(string nomFichier, int maximum);
string goToLine(fstream& monFlux, int numeroLigne); string goToLine(fstream& monFlux, int numeroLigne);
void afficherMenuJouer(); void 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);