Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Upload your . cpp source code file to Ecampus. This program is a word / phrase guessing game similar to the classic hangman game. You
Upload your cpp source code file to Ecampus.
This program is a wordphrase guessing game similar to the classic hangman game. You should put your own theme not hangman onto the game. All screens should include ASCII art that matches your theme. The game should include:
Introduction screen that has your name and introduces your theme includes ASCII art
Winning and losing screens includes ASCII art
Game loop that displays ASCII art that changes with each incorrect guess.
Letters guessed or remaining
Steps in the program:
Introduction Screen
Select a random word and store it in a string variable name SecretPhrase
Create GuessPhrase which will be the same size as SecretPhrase, but all periods eg
string GuessPhrase SecretPhrase;
for int x ; x SecretPhrase.size; x
if SecretPhrasex
GuessPhrasex;
else
GuessPhrasex;
Declare an integer named BadGuesses
Declare a string named Letter
Declare a string named LettersRemaining and make it equal to the alphabet
Declare an integer named Location
Set up a while loop for steps This is the main loop of the program. The game keeps playing as long as you haven't lost when BadGuesses and you haven't won when GuessWord SecretWord
This is the opening brace for the game loop
Display ASCII art graphics do this step last
Display letters remaining
Output GuessPhrase
Prompt player to enter a letter their guess and store it in the variable Letter. Remove this letter from LettersRemaining.
If Letter is not located in SecretPhrase note: use Letter.find increment BadGuesses
Else continue looping and find all occurrences of Letter in GuessWord and replace the periods.
Step
Location SecretPhrase.findLetter;
if Location not found
BadGuesses;
else
while Location SecretPhrase.size
GuessPhrase.replaceLocationLetter;
Location SecretPhrase.findLetter Location ;
If you exit the loop, then you've either won or lost. Therefore, if BadGuesses then display the losing screen, else display the winning screen.
Extra Credit Ideas
a Outstanding graphics and theme
b Ask the user to select a subject for their secret word eg college, movies, etc.
c Make your program work with capitalized letters in the secret phrase.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started