lab.cpp/tp1.cpp

51 lines
1.0 KiB
C++
Raw Normal View History

2016-03-04 07:49:31 +00:00
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
2016-03-04 13:18:01 +00:00
#include "tp1/wordproc.cpp"
2016-03-04 07:49:31 +00:00
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
=========================================================*/
2016-03-04 13:18:01 +00:00
cout << "Mot secret: ";
cin >> word;
cout << endl;
// On met le mot en majuscules
word = toUpperCase(word);
2016-03-04 07:49:31 +00:00
2016-03-04 13:18:01 +00:00
/* [2] On melange les lettres du mot
2016-03-04 07:49:31 +00:00
=========================================================*/
2016-03-04 13:18:01 +00:00
shuffled = shuffle(word);
2016-03-04 07:49:31 +00:00
2016-03-04 13:18:01 +00:00
/* [3] JEU > utilisateur
2016-03-04 07:49:31 +00:00
=========================================================*/
2016-03-04 13:18:01 +00:00
string guessed;
do{
cout << "What is this world ? " << shuffled << endl;
cin >> guessed;
cout << endl;
}while( toUpperCase(guessed) != word );
cout << "Vous avez gagne!!" << endl;
2016-03-04 07:49:31 +00:00
return 0;
}