So down here is my code, the meaning of this prog. is that I will have a word, type out a '_' for every char in theWord.
Everything is compiling like it should be but something is still wrong.
If I guess s, t, c it will type out: s_t_ _c.
What I want to do is instead of writing between the underscores it should replace the underscore with the guessed char.
Any tips and trix?
for(unsignedint i = 0; i < theWord.length(); i++)
{
bool guess_ok = false; // You need this variable in order to determine if you have to output the '_'
for(unsignedint j = 0; j < (int)correctGuesses.size(); j++)
{
guess_ok = (theWord[i] == correctGuesses[j]); // Now set the variable
// if(theWord[i] == correctGuesses[j])
if(guess_ok)
{
std::cout << theWord[i];
break; // NOTE: You don't want to continue; if the guess is ok
}
}
if(! guess_ok) // Note: Only if not guess ok output the '_'
std::cout << " _ ";
}