Okay so I placed the loop like this
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
|
while (wrongC < 7 && rightC < word.length());
if(rightC == word.length()) //IF player won
{
cout<<endl;
cout<<"\t YOU WIN!"<<endl;
cout<< "\t@@@@@@@@@@@@@@@"<<endl;
cout<< "\t @@@@@@@@@@@@@"<<endl;
cout<< "\t @@@@@@@@@@@"<<endl;
cout<< "\t @@@@@@@@@"<<endl;
cout<< "\t OOOOOOOOO"<<endl;
cout<< "\t 0*********0"<<endl;
cout<< "\t 0***********0"<<endl;
cout<< "\t 0* MEDAL *0"<<endl;
cout<< "\t 0***********0"<<endl;
cout<< "\t 0*********0"<<endl;
cout<< "\t OOOOOOOOO"<<endl;
cout<< "\tYOU SAVED THE MAN! "<<endl;
}
else
{
for (wordis = 0; wordis <word.length();wordis++)
{
cout<<"The word was: "<< word << "!"<< endl;
}
cout<<endl;
cout<<endl;
cout<< "YOU LOSE!"<<endl; //if player lost
cout<< "THE MAN WAS HANGED!"<<endl;
cout<< endl;
cout<< " I-------|"<<endl;
cout<< " I *"<<endl;
cout<< " I *"<<endl;
cout<< " I Q"<<endl;
cout<< " I /|\\"<<endl;
cout<< " I |"<<endl;
cout<< " _|_ ``| / \\ |`` "<<endl;
}//else closes
| |
And it shows the correct word, but it keeps repeating it like 10 times. For example:
"YOU LOSE!
THE MAN WAS HANGED!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!
The word was: MONSTERHUNTER!"
How can I make it stop repeating like that?