Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Hangman Game (programming in C)? This version of the game will have the following requirements: Create a menu for the user to choose from,

The Hangman Game (programming in C)?

image text in transcribed

image text in transcribed

This version of the game will have the following requirements: Create a menu for the user to choose from, similar to the following: 1. Play a game 2. Display statistics 3. Quit The following actions should take place based on the menu. If the user chooses: 1. Play the game: Ask for the player's (user's) name and store it. The computer randomlye chooses a secret word from 10 words available and stored in a 2D array of characters. Assume 30 characters as a fixed maximum length of each word. Display underscores to the player depending on the number of letters the chosen word has. Say the word chosen was mystery. You need to display 7 underscores: Ask the player to guess a letter. Check if the letter is included in the secret word and display. Ex. if the user chooses y, then you should display Y.---y. The player has 10 tries to correctly find the word. Moreover, you need to change the player's score depending on the following criteria: Criteria Points Letter found 10 Letter not found 2 Word found 100 Word not found -40 Note: If the player chooses a letter which he/she has already chosen before, display a message and let the user try again without changing the points earned so far, nor decrementing his total tries. The game ends when the player has found the word or when all the available tries are used up. Once the game ends, display the player's name and score. Afterwards go back and display the initial menu. 2. Do nothing for now. 3. Quit the game. We have not yet learned how to read in a string, store and display it, so please use the following code to perform this task: char name (11);//Stores a name up to 10 characters. //The extra element is for the '10' (string terminator). printf(" What is your name? "); scanf("%s", name); printf(" your name is %s", name); You will need to demonstrate arrays, loops, if-else and switch/case statements and use of functions (and passing arrays to functions) in this program. No global variables are allowed! You can use the following naming convention (or anything you choose, but you need to stick to it!): camel casing for variable names, Pascal casing for functions and all capital for constants. Do not forget to comment your code where necessary. The minimum is a function header for each function and a program header to explain what your program does. All code should be written in a single.c file. Test your program to make sure it works properly. Assume no error checking for invalid data. You should handle the case where the user enters anything different than 1, 2 or 3, in the menu though

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions