You will write a C program that will play a letter guessing game.
General Requirements
? Write a program that reads letters from a file called “lettersin.txt”.
? Your program will ask the user to enter the number of games they wish to play (1 to 4)
? Your program will open the lettersin.txt file read in one character at a time and repeat this for the
number of games the user wants to play.
? For this assignment the test file will contain letters, all lowercase
? When the number of games has been played, the program will end
? A sample of an input file that you can use to test your program is included with the assignment.
? A preprocessor directive must be used to define the maximum number of guesses as 5
? If the player has used up all of their guesses, a message that the game is over should be displayed
along with the letter they were trying to guess.
? You must have at least 4 user defined functions as follows:
//this function provides instructions to the user on how to play the game
void GameRules( );
//this function runs one entire game. It for checks either 5 incorrect guesses or a correct guess.
//It returns a 0 if the game is over and the player did not guess the letter, otherwise it returns 1.
int SingleGame(char file_letter);
//this function prompts the player to make a guess and returns that guess
//this function is called from inside the SingleGame( ) function described above
char RetrieveGuess( );
//this function takes two arguments, the guess from the player
//and the solution letter from the file.
//It lets the user know if the guess comes alphabetically before or after the answer
//The function returns 1 if the guess matches the solution and returns a 0 if they do not match
//this function is called from inside the OneGame( ) function described above
int GuessedIt(char answer, char input_letter);
Additional Requirements:
? Use function prototypes.
? Write comments for each function that will appear in the file before each prototype and
again before each function definition.
? Be sure to comment your code adequately.
? Be sure to indent properly. Check your textbook and lecture code examples to see how it should
be done.
? Use meaningful variable names
? Check all requirements list on Blackboard before submitting

New Download