1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
void dataForPlayer2 (string guessedLetters, string triedLetters)
{
cout<<""<<endl;
cout<<guessedLetters<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"Tried and failed letters: "<<triedLetters<<endl;
cout<<""<<endl;
cout<<""<<endl;
}
int wordGuessingCycle (int availableRounds,int &spentRounds, int&remainingRounds,string player1,string player2, string wordToGuess,string &guessedLetters, bool &endMatch, int &points1, int &points2, int winner)
{
char letterToLookUp;
string triedLetters, chance;
bool found=false;
...
cout<<"Input word"<<endl;
cin>>chance;
if (chance.size()!=1)
{
revision(wordToGuess,player1,points1,player2,endMatch,points2,remainingRounds,avavailableRounds,winner,chance);
}
else
{
letterToLookUp = chance[0];
unsigned int position=0;
for (position=0;position<=(wordToGuess.size()+1);position++)
{
if (wordToGuess[position]==letterToLookUp)
{
...
}
if ((position>wordToGuess.size())&&(not found))
{
cout<<"Letter not present."<<endl;
spentRounds++;
triedLetters.append(chance);
dataForPlayer2(guessedLetters,triedLetters);
}
}
...
};
return 0;
|