Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an interactive C program that lets a user play a game of Hangman. Please explain and justify the code, thanks so much! pUlnts: Write

Write an interactive C program that lets a user play a game of Hangman.
Please explain and justify the code, thanks so much! image text in transcribed
pUlnts: Write an interactive C program that lets a user play a game of Hangman 1) Your program gets the secret word (7 letters in each word) by calling the given function: void get word(char word[]) ( char WORDJ8] -("program", "puzzles", "squeeze", "circuit", "devoted", "journey", "version", "totally", "respect" b int i, num; num (rand() % 9); for (i 0; i #include // enable use of rand() // enable use of time() and srand((int)time(0)); 3) Initially the program prints on the screen the number of letters of the word to be guessed. This is in the form of successive stars (see sample code execution on the next page) The player makes a guess on the letters belonging to the secret word one by one. At each step, the program prints on the screen the letters that have been guessed, and the number of wrong guesses. The program terminates when either a) all letters have been guessed correctly (the player wins) or b) 7 guesses have been made (the player loses). Your program must be modular. Create at least TWo meaningful functions that abstract details such as printing the word after a letter guess is attempted or searching for a letter within a word. Suggestion: Use another array, guessed, to keep track of the solution so far. Initialize all elements of guessed to the*' symbol. Each time a letter in word is guessed correctly, replace the corresponding"* in guessed with that letter

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

More Books

Students also viewed these Databases questions