ajout de 3 fonctions
This commit is contained in:
@@ -87,31 +87,32 @@ void curseur(bool interrupteur) {
|
||||
1 - JOUER
|
||||
====================================*/
|
||||
//fonction pour choisir le mot de facon random
|
||||
void choisirMot(string nomFichier, int maximum) {
|
||||
int numeroLigne = rand() % (maximum)+1;
|
||||
|
||||
fstream monFlux;
|
||||
ouvrirFichier(monFlux, nomFichier);
|
||||
string mot = goToLine(monFlux, numeroLigne);
|
||||
fermerFichier(monFlux);
|
||||
}
|
||||
string goToLine(fstream& monFlux, int numeroLigne) {
|
||||
string mot;
|
||||
for (int i = 0; i < numeroLigne; i++) {
|
||||
getline(monFlux, mot);
|
||||
}
|
||||
return mot;
|
||||
}
|
||||
|
||||
void afficherMenuJouer() {
|
||||
void afficherMenuJouer()
|
||||
{
|
||||
cout << setw(83) << "=============================================\n";
|
||||
string motPlayer;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
do
|
||||
{
|
||||
cout << setw(65) << "Tentative #" << i + 1 << endl;
|
||||
cout << setw(69) << "Saisir votre mot : ";
|
||||
cin >> motPlayer;
|
||||
} while (motPlayer.length() > 3);
|
||||
|
||||
if (dansListe(motPlayer))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << setw(58) << "Mot n'est pas dans la liste";
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
cout << setw(66) << "Votre mot est : " << motPlayer;
|
||||
}
|
||||
|
||||
@@ -33,3 +33,5 @@ void choisirMot(string nomFichier, int maximum);
|
||||
string goToLine(fstream& monFlux, int numeroLigne);
|
||||
|
||||
void afficherMenuJouer();
|
||||
bool dansListe(string motPlayer);
|
||||
bool comparerMot(fstream& monFlux, string motPlayer, int numeroLigne);
|
||||
Reference in New Issue
Block a user