Hangman I: Submit Assignment
Hangman I: Submit Assignment
Hangman I
Submit Assignment
This week we will start developing a simple version of the Hangman game, which you will be improving
in the upcoming weeks, to reach the final version submitted during week 8.
The purpose of this assignment is to be able to apply the following programming concepts towards the
creation of a well-structured program, which produces the correct results: arrays, loops, decision
statements, expressions, variables and console i/o.
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 randomly
(https://www.tutorialspoint.com/c_standard_library/c_function_rand.htm) 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
https://capitol.instructure.com/courses/6298/assignments/88242 1/3
3/1/2021 Hangman I
correctly find the word. Moreover, you need to change the player’s score depending on the
following criteria:
Criteria Points
Letter found 10
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.
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:
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
https://capitol.instructure.com/courses/6298/assignments/88242 2/3
3/1/2021 Hangman I
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.
Students who do not follow these requirements, but instead submit something totally different,
will receive a grade of 0 with no option to resubmit. Any cases of plagiarism will be reported.
https://capitol.instructure.com/courses/6298/assignments/88242 3/3