Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C please Write an interactive program that plays a game of hangman. Store the characters of the word to be guessed in an array

IN C please

Write an interactive program that plays a game of hangman. Store the characters of the word to be guessed in an array of type char (you can initialize your character array at declaration). Words are seven letters long. Initially, the program displays the length of the word to be guessed. This is in the form of successive stars (see example). The player guesses letters belonging to the secret word one by one. After each guess, the letters that have been guessed and the number of wrong guesses are displayed on the screen. Your program should terminate when either the entire word is guessed or 4 incorrect guesses have been attempted.

Your code shall use the following function:

bool letterCheck(char secret[], char found[], int len, char c, int *times); 

The function receives as input array secret that holds the secret word, array found that holds the letters that have been found thus far, the length of the secret word, and the input character from the user. The function returns if the letter given by the user was found in array secret (via the boolean return variable), updates array found, and also returns the number of times the letter was found via pointer times

Test your program for the words: abandon, annoyed, finance, aerobic, inferno, infancy.

Sample output Hi, lets play hangman. The secret word is: ******* Guess a letter:t Letter t is not part of the secret word, You have 3 attempts left. ******* Guess a letter:a Letter a exists 2 times in the secret word, You have 3 attempts left. a*a**** Guess a letter:e Letter e is not part of the secret word, you have 2 attempts left.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

Discuss the techniques of sales forecasting.

Answered: 1 week ago

Question

Write short notes on Marketing mix.

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago