============================== run 1: the user wins the game ============================== % ./a.out Let's play hangman! I will pick a secret phrase On each turn, you guess a letter. If the letter you guess is in the secret phrase, I will show you where it appears. You only get 8 incorrect guesses. Good luck. Please enter the name of the words file: blah Could not open file blah, try again Please enter the name of the words file: dict.txt /---- | | | | | L______ Secret phrase: - - - - - - - - - - - - - - - - - - - - - - - - - - You have 8 guesses left Letters guessed: Your guess (enter ! to quit): a That guess is correct. /---- | | | | | L______ You have 8 guesses left Letters guessed: A, Your guess (enter ! to quit): b There are no B's in the phrase /---- | | | | | | L______ Secret phrase: A - - - - - - - - - - - - - A - - - - - - - - - - - You have 7 guesses left Letters guessed: A, B, Your guess (enter ! to quit): c There are no C's in the phrase /---- | | | O | | | L______ Secret phrase: A - - - - - - - - - - - - - A - - - - - - - - - - - You have 6 guesses left Letters guessed: A, B, C, Your guess (enter ! to quit): d There are no D's in the phrase /---- | | | O | | | | L______ Secret phrase: A - - - - - - - - - - - - - A - - - - - - - - - - - You have 5 guesses left Letters guessed: A, B, C, D, Your guess (enter ! to quit): e That guess is correct. /---- | | | O | | | | L______ Secret phrase: A - - - - - - - - - - - E - A - - E - - - - - - - - You have 5 guesses left Letters guessed: A, B, C, D, E, Your guess (enter ! to quit): f There are no F's in the phrase /---- | | | O | | | | | L______ Secret phrase: A - - - - - - - - - - - E - A - - E - - - - - - - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, Your guess (enter ! to quit): . .'s not an alphabetic character, try again Your guess (enter ! to quit): a You already guessed A, try again. Your guess (enter ! to quit): F You already guessed F, try again. Your guess (enter ! to quit): r That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R - - - - - - - - - - E - A - - E R - - - - - - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, R, Your guess (enter ! to quit): o That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O - - - - - - - O - E - A - - E R - - O - O - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, O, R, Your guess (enter ! to quit): l That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L - - - - - O - E - A - - E R - - O - O - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, L, O, R, Your guess (enter ! to quit): i That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L I - - - - O - E - A - - E R - - O - O - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, I, L, O, R, Your guess (enter ! to quit): n That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L I N - - - O N E - A - - E R - N O - O - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, I, L, N, O, R, Your guess (enter ! to quit): g That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L I N G - - O N E G A - - E R - N O - O - - You have 4 guesses left Letters guessed: A, B, C, D, E, F, G, I, L, N, O, R, Your guess (enter ! to quit): s That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L I N G S - O N E G A - - E R S N O - O S S You have 4 guesses left Letters guessed: A, B, C, D, E, F, G, I, L, N, O, R, S, Your guess (enter ! to quit): t That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L I N G S T O N E G A T - E R S N O - O S S You have 4 guesses left Letters guessed: A, B, C, D, E, F, G, I, L, N, O, R, S, T, Your guess (enter ! to quit): h That guess is correct. /---- | | | O | | | | | L______ Secret phrase: A R O L L I N G S T O N E G A T H E R S N O - O S S You have 4 guesses left Letters guessed: A, B, C, D, E, F, G, H, I, L, N, O, R, S, T, Your guess (enter ! to quit): m That guess is correct. You guessed the phrase A ROLLING STONE GATHERS NO MOSS. You Win!!! You only had 4 wrong guesses ============================== run 2: the user loses the game ============================== % ./a.out Let's play hangman! I will pick a secret phrase On each turn, you guess a letter. If the letter you guess is in the secret phrase, I will show you where it appears. You only get 8 incorrect guesses. Good luck. Please enter the name of the words file: dict.txt /---- | | | | | L______ Secret phrase: - - - - - - - - - - - - - - - - - - - - - - - - - - You have 8 guesses left Letters guessed: Your guess (enter ! to quit): a That guess is correct. /---- | | | | | L______ Secret phrase: A - - - - - - - - - - - - - A - - - - - - - - - - - You have 8 guesses left Letters guessed: A, Your guess (enter ! to quit): r That guess is correct. /---- | | | | | L______ Secret phrase: A R - - - - - - - - - - - - A - - - R - - - - - - - You have 8 guesses left Letters guessed: A, R, Your guess (enter ! to quit): o That guess is correct. /---- | | | | | L______ Secret phrase: A R O - - - - - - - O - - - A - - - R - - O - O - - You have 8 guesses left Letters guessed: A, O, R, Your guess (enter ! to quit): l That guess is correct. /---- | | | | | L______ Secret phrase: A R O L L - - - - - O - - - A - - - R - - O - O - - You have 8 guesses left Letters guessed: A, L, O, R, Your guess (enter ! to quit): x There are no X's in the phrase /---- | | | | | | L______ Secret phrase: A R O L L - - - - - O - - - A - - - R - - O - O - - You have 7 guesses left Letters guessed: A, L, O, R, X, Your guess (enter ! to quit): z There are no Z's in the phrase /---- | | | O | | | L______ Secret phrase: A R O L L - - - - - O - - - A - - - R - - O - O - - You have 6 guesses left Letters guessed: A, L, O, R, X, Z Your guess (enter ! to quit): y There are no Y's in the phrase /---- | | | O | | | | L______ Secret phrase: A R O L L - - - - - O - - - A - - - R - - O - O - - You have 5 guesses left Letters guessed: A, L, O, R, X, Y, Z Your guess (enter ! to quit): p There are no P's in the phrase /---- | | | O | | | | | L______ Secret phrase: A R O L L - - - - - O - - - A - - - R - - O - O - - You have 4 guesses left Letters guessed: A, L, O, P, R, X, Y, Z Your guess (enter ! to quit): q There are no Q's in the phrase /---- | | | O | |/ | | | L______ Secret phrase: A R O L L - - - - - O - - - A - - - R - - O - O - - You have 3 guesses left Letters guessed: A, L, O, P, Q, R, X, Y, Z Your guess (enter ! to quit): r You already guessed R, try again. Your guess (enter ! to quit): s That guess is correct. /---- | | | O | |/ | | | L______ Secret phrase: A R O L L - - - S - O - - - A - - - R S - O - O S S You have 3 guesses left Letters guessed: A, L, O, P, Q, R, S, X, Y, Z Your guess (enter ! to quit): m That guess is correct. /---- | | | O | |/ | | | L______ Secret phrase: A R O L L - - - S - O - - - A - - - R S - O M O S S You have 3 guesses left Letters guessed: A, L, M, O, P, Q, R, S, X, Y, Z Your guess (enter ! to quit): n That guess is correct. /---- | | | O | |/ | | | L______ Secret phrase: A R O L L - N - S - O N - - A - - - R S N O M O S S You have 3 guesses left Letters guessed: A, L, M, N, O, P, Q, R, S, X, Y, Z Your guess (enter ! to quit): w There are no W's in the phrase /---- | | | O | \|/ | | | L______ Secret phrase: A R O L L - N - S - O N - - A - - - R S N O M O S S You have 2 guesses left Letters guessed: A, L, M, N, O, P, Q, R, S, W, X, Y, Z Your guess (enter ! to quit): u There are no U's in the phrase /---- | | | O | \|/ | | | \ L______ Secret phrase: A R O L L - N - S - O N - - A - - - R S N O M O S S You have 1 guesses left Letters guessed: A, L, M, N, O, P, Q, R, S, U, W, X, Y, Z Your guess (enter ! to quit): i That guess is correct. /---- | | | O | \|/ | | | \ L______ Secret phrase: A R O L L I N - S - O N - - A - - - R S N O M O S S You have 1 guesses left Letters guessed: A, I, L, M, N, O, P, Q, R, S, U, W, X, Y, Z Your guess (enter ! to quit): b There are no B's in the phrase /---- | | | O | \|/ | | | / \ L______ Sorry, you lose. The phrase was A ROLLING STONE GATHERS NO MOSS.