You will write a C program that will play a letter guessing game.General Requirements Write a program that reads letters from a file calledlettersin.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 thenumber 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 displayedalong 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 gamevoid 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 abovechar 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 aboveint 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 andagain 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 shouldbe done. Use meaningful variable names Check all requirements list on Blackboard before submittingSample Output:Welcome to the Letter Guessing GameYou will enter the number of games you want to play (1 4 games)You have 5 chances to guess each letterLets begin:How many games do you want to play (1-4) 3************************************Lets play game 1Enter a guess: ethe letter you are trying to guess comes before eEnter a guess: cthe letter you are trying to guess comes before cEnter a guess: aYou guessed it!!!************************************Lets play game 2Enter a guess: tthe letter you are trying to guess comes before tEnter a guess: athe letter you are trying to guess comes after aEnter a guess: pthe letter you are trying to guess comes before pEnter a guess: nthe letter you are trying to guess comes before nEnter a guess: gthe letter you are trying to guess comes after gYou did not guess the letter. It was m************************************Lets play game 3Enter a guess: gthe letter you are trying to guess comes after gEnter a guess: mthe letter you are trying to guess comes after mEnter a guess: tthe letter you are trying to guess comes before tEnter a guess: rthe letter you are trying to guess comes before rEnter a guess: sthe letter you are trying to guess comes before sYou did not guess the letter. It was nPress any key to continue . . .
Programming
[Solved] SOLVED:Letter guessing game
$25
File Name: SOLVED:Letter_guessing_game.zip
File Size: 254.34 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.