Starting from:

$15

Assignment: #5 (Hangman Part 1) Solution

Submit your source code to Blackboard by the deadline.
Please name your program in so that it includes both your FAU user ID
and the assignment number.
For example: jmulcah1_assig5.c
+-----------------------+
| Assignment Objective: |
+-----------------------+
In this assignment, you will create an interactive program that lets the
user play the game of Hangman, demonstrating your knowledge about the
following concepts:
- Standard Input/Output (printf, scanf)
- Functions & Function Prototypes (declaring, defining and invoking)
- Conditional logic (if/else)
- Loops (while, do/while, for)
- File I/O
+--------------------+
| General algorithm: |
+--------------------+
- Read a single word (a string of characters) from an input file, and
give the player a maximum number of chances to guess all of the
letters in that word, as described below.
- If the player has guessed all of the letters in the word before running
out of chances, the game is over and they are congratulated.
- If the player runs out of chances, but some letters have not been guessed,
the game is over, and they are consoled and shown the whole word.
- If the player guesses a letter that is not in the word, a message is printed
to that effect and they get to guess again, unless they have used up all
their chances.
- If the player guesses a letter that is in the word, every occurrence of that
letter is considered to have been guessed, and they get to guess another
letter, unless the entire word has been guessed, or they have run out of
chances.
- The player continues to guess letters until the entire word has been guessed,
or they have run out of chances.
- Once the game is over, you should thank the user for playing, close the input
file, and exit the program.

More products