Write a program to simulate the LetterboxLinks to an external site. game show. For our program, the game is more simplified and is played as follows: The program selects a random word for the user to guess. The user guesses one letter at a time until either they guess the word, or they run out of guesses. The word to guess has 5 letters. ----- Available letters: abcdefghijklmnopqrstuvwxyz 7 incorrect guesses remaining Please enter your guess: s s is not in the word. Too bad. 6 incorrect guesses remaining. ----- Available letters: abcdefghijklmnopqr tuvwxyz 6 incorrect guesses remaining. Please enter your guess: e Nice! e is in the word. -e--- Available letters: abcd fghijklmnopqr tuvwxyz 6 incorrect guesses remaining. Please enter your guess: r r is not in the word. Too bad. 5 incorrect guesses remaining. -e--- Available letters: abcd fghijklmnopq tuvwxyz 5 incorrect guesses remaining. Please enter your guess: r r is not an available letter -e--- Available letters: abcd fghijklmnopq tuvwxyz 5 incorrect guesses remaining. Please enter your guess: l Nice! l is in the word. -ell- Available letters: abcd fghijk mnopq tuvwxyz 5 incorrect guesses remaining. Please enter your guess: h Nice! h is in the word. hell- Available letters: abcd fg ijk mnopq tuvwxyz 5 incorrect guesses remaining. Please enter your guess: o Nice! o is in the word. Congrats, you guessed the word hello! ----------Apply the three file format.-------- main.cpp letterbox.cpp letterbox.h Read words for the user to guess into an array of strings from a file. Create a text file words.txt. This file MUST contain at least 10 words but no more than 100 words, one word per line, and each word can have a maximum of 12 characters. The program must work with any file named words.txt that has from 10 to 100 words. You MUST write in-line comments to explain sections of your code to increase its readability. You MUST also write function header comments for all your functions. Follow the format taught in the lecture and lab. Describe what the function does, a description of each parameter if needed and a description of what the function returns if needed.
Write a program to simulate the LetterboxLinks to an external site. game show. For our program, the game is more simplified and is played as follows:
- The program selects a random word for the user to guess.
- The user guesses one letter at a time until either they guess the word, or they run out of guesses.
The word to guess has 5 letters.
-----
Available letters: abcdefghijklmnopqrstuvwxyz
7 incorrect guesses remaining
Please enter your guess:
s
s is not in the word. Too bad. 6 incorrect guesses remaining.
-----
Available letters: abcdefghijklmnopqr tuvwxyz
6 incorrect guesses remaining.
Please enter your guess:
e
Nice! e is in the word.
-e---
Available letters: abcd fghijklmnopqr tuvwxyz
6 incorrect guesses remaining.
Please enter your guess:
r
r is not in the word. Too bad.
5 incorrect guesses remaining.
-e---
Available letters: abcd fghijklmnopq tuvwxyz
5 incorrect guesses remaining.
Please enter your guess:
r
r is not an available letter
-e---
Available letters: abcd fghijklmnopq tuvwxyz
5 incorrect guesses remaining.
Please enter your guess:
l
Nice! l is in the word.
-ell-
Available letters: abcd fghijk mnopq tuvwxyz
5 incorrect guesses remaining.
Please enter your guess:
h
Nice! h is in the word.
hell-
Available letters: abcd fg ijk mnopq tuvwxyz
5 incorrect guesses remaining.
Please enter your guess:
o
Nice!
o is in the word.
Congrats, you guessed the word hello!
----------Apply the three file format.--------
- main.cpp
- letterbox.cpp
- letterbox.h
Read words for the user to guess into an array of strings from a file. Create a text file words.txt. This file MUST contain at least 10 words but no more than 100 words, one word per line, and each word can have a maximum of 12 characters. The program must work with any file named words.txt that has from 10 to 100 words.
-
You MUST write in-line comments to explain sections of your code to increase its readability.
-
You MUST also write function header comments for all your functions. Follow the format taught in the lecture and lab. Describe what the function does, a description of each parameter if needed and a description of what the function returns if needed.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images