You are on page 1of 2

#include

#include
#include
#include
#include
#include

<iostream>
<fstream>
<string>
<cstring>
<ctime>
<cstdlib>

using namespace std;


int main()
{
string words[4000];
ifstream fread("words.doc");
if(!fread)
{
cout << "Could'nt open \"words.txt\" ";
}
for(int i = 0;i < 4000; i++)
{
fread >> words[i];
}
fread.close();
srand(time(0));
int randGen = 1 + rand() % 4000 ;
string guess_word;
guess_word = words[1];
cout << guess_word;
cout << endl << guess_word.length();
char* wordarr = new char[guess_word.length()];
for(unsigned int i = 0; i < guess_word.length(); i++)
{
int randPos = rand() % 2;
if( randPos )
{
wordarr[i] = guess_word[i];
}
else
{
wordarr[i] = '-';
}
}
for(int i = 2; i >= 0; i--)
{
cout << wordarr;

char user_in;
cout << endl << endl << "Enter the guessed word: ";
cin >> user_in;
for(unsigned int i = 0; i < guess_word.length(); i++)
{
if(user_in == guess_word[i] )
{
wordarr[i] = user_in;
}
};
}
//______________________________________________________________________________
______________________
/*if(user_in == guess_word)
{
cout << endl << "
You are genius :), You g
uessed what I have thought.";
}
else if(i != 0)
{
cout << endl << "
Sorry!! Try another." <<
endl << "
You have " << i << " lives left,";
}
else
cout << "
You failed!" << endl << "
Word was \'" << guess_word << "\' .";
}
}*/

return 0;
}

You might also like