51 lines
1.0 KiB
C++
51 lines
1.0 KiB
C++
#include <iostream>
|
|
#include <fstream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "tp1/wordproc.cpp"
|
|
|
|
using namespace std;
|
|
|
|
|
|
int main(){
|
|
|
|
/* [0] CONSTANTES
|
|
=========================================================*/
|
|
const string dict_filename = "tp1/dict";
|
|
ifstream dict_read( dict_filename.c_str() );
|
|
|
|
|
|
/* [0] VARIABLES
|
|
=========================================================*/
|
|
string word;
|
|
string shuffled;
|
|
|
|
/* [1] Demande du mot
|
|
=========================================================*/
|
|
cout << "Mot secret: ";
|
|
cin >> word;
|
|
cout << endl;
|
|
|
|
// On met le mot en majuscules
|
|
word = toUpperCase(word);
|
|
|
|
/* [2] On melange les lettres du mot
|
|
=========================================================*/
|
|
shuffled = shuffle(word);
|
|
|
|
/* [3] JEU > utilisateur
|
|
=========================================================*/
|
|
string guessed;
|
|
|
|
do{
|
|
cout << "What is this world ? " << shuffled << endl;
|
|
cin >> guessed;
|
|
cout << endl;
|
|
|
|
}while( toUpperCase(guessed) != word );
|
|
|
|
cout << "Vous avez gagne!!" << endl;
|
|
|
|
return 0;
|
|
} |