last day (16 days later) » 

11:25 PM
hi, do you got some time?
i created this function as you suggested and it works, but is it what you meant?
char get_guess(std::string guessed_letters)
{
    char letter=' ';
    while (!is_inside(alphabet,letter) || is_inside(guessed_letters, letter) )
    {
        std::cin >> letter;
        std::cin.clear();
        std::cin.ignore( std::numeric_limits <std::streamsize> ::max(), '\n' );
    }
    return letter;
}
but for the outer loop i run in a problem
i want that the dictionary is loaded exactly one time per execution. so i have to pass this as an argument to the do_one_game function or?
 
11:50 PM
Yes, if you want to avoid loading the dictionary every time, you have to pass it as an argument to do_one_game() (preferably as a const reference).
The function get_guess() reads in input from the keyboard until you get a valid guess, and returns that. So in do_one_game(), you'd write: char letter = get_guess(), and then check whether that guess was in secret_word or not.
Sorry, I'm afraid I have to go, but I'll check tomorrow and answer any questions you have posted then.
 

  last day (16 days later) »