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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:

  1. The program selects a random word for the user to guess.
  2. 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.--------

  1. main.cpp
  2. letterbox.cpp
  3. 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.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Threads
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education