diff --git a/main.cpp b/main.cpp index 2fa71ff..c93c528 100644 --- a/main.cpp +++ b/main.cpp @@ -40,9 +40,9 @@ int main() { delai(); curseur(true); system("cls"); - background(temp); - motRandom = choisirMot("Mots/mot3lettres.txt", nbMot3lettre); - afficherMenuJouer(); + //background(temp); + + effectuerTour(); break; case '2': diff --git a/mesFonctions.cpp b/mesFonctions.cpp index f509966..0efb0c3 100644 --- a/mesFonctions.cpp +++ b/mesFonctions.cpp @@ -95,6 +95,7 @@ string choisirMot(string nomFichier, int maximum) {//Choisi un mot al fermerFichier(monFlux); return motRandom; } + string goToLine(fstream& monFlux, int numeroLigne) {//génère un nb aléatoire, et choisi une ligne associé pour un mot aléatoire. renvoi le mot choisi string mot; for (int i = 0; i < numeroLigne; i++) { @@ -103,11 +104,14 @@ string goToLine(fstream& monFlux, int numeroLigne) {//g return mot; } -void afficherMenuJouer() +void effectuerTour() { + string motRandom = choisirMot("Mots/mot3lettres.txt", 15); + cout << setw(83) << "=============================================\n"; string motPlayer; + for (int nbTentative = 0; nbTentative < 6; nbTentative++) { do @@ -115,11 +119,15 @@ void afficherMenuJouer() cout << setw(65) << "Tentative #" << nbTentative + 1 << endl; cout << setw(69) << "Saisir votre mot : "; cin >> motPlayer; - } while (motPlayer.length() > 3); + } while (motPlayer.length() == 3); 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 { @@ -145,11 +153,13 @@ bool dansListe(string motPlayer) if (motPlayer == mot) { + fermerFichier(monFlux); return true; } } - return false; fermerFichier(monFlux); + return false; + } diff --git a/mesFonctions.h b/mesFonctions.h index 8c72fee..5647e2e 100644 --- a/mesFonctions.h +++ b/mesFonctions.h @@ -32,6 +32,6 @@ void backgroundDefault(); string choisirMot(string nomFichier, int maximum); string goToLine(fstream& monFlux, int numeroLigne); -void afficherMenuJouer(); +void effectuerTour(); bool dansListe(string motPlayer); bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne); \ No newline at end of file