Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Intro to Programming in C Large Program 1 Letter guessing Game You will write a program that will play a letter guessing game. General Requirements

Intro to Programming in C Large Program 1 Letter guessing Game You will write a program that will play a letter guessing game. General Requirements Write a program that reads letters from a file called letters.txt. Your program will ask the user to enter the number of games they wish to play (1 to 8) Your program will open the letters.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 at least 8 letters, uppercase OR lowercase In your program you will change each letter (solution and guess) to uppercase o Use the function toupper in #include 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 5 user defined functions as follows: o No modifications may be made to the functions

#define _CRT_SECURE_NO_WARNINGS #include #include #define MAXGUESSES 5 //this function provides instructions to the user on how to play the game void LetterGuessRules(); //this function asks, gets, and //returns the number of games the user wants to play int GameCount(); //this function runs one game. //input: character from the file, void return type //all other functions to Play one round of a game //are called from within the PlayOneGame function void PlayOneGame(char solution); //this function prompts the player to make a guess and returns that guess //this function is called from inside the PlayOneGame( ) function described above char GetGuess(); //this function takes two arguments, the guess from the player //and the solution letter from the file. //The function returns 1 if the guess matches the solution and returns a 0 if they do not match //This function also lets the user know if the guess comes alphabetically before or after the answer int CompareGuessAndSolution(char guess, char solution); 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 SAMPLE OUTPUT: Welcome to the letter guessing game! First, you will enter the number of games you want to play (1 - 8 games) For each game you will have 5 chances to guess each letter Let's begin: How many games do you want to play (1 to 8)? 3 ************************** Let's play game 1 Enter a guess: t The solution (?) comes alphabetically before your guess (T) Enter a guess: d The solution (?) comes alphabetically after your guess (D) Enter a guess: h Awesome! You won that round! ************************** Let's play game 2 Enter a guess: s Awesome! You won that round! ************************** Let's play game 3 Enter a guess: a The solution (?) comes alphabetically after your guess (A) Enter a guess: g The solution (?) comes alphabetically after your guess (G) Enter a guess: k The solution (?) comes alphabetically after your guess (K) Enter a guess: m The solution (?) comes alphabetically after your guess (M) Enter a guess: q The solution (?) comes alphabetically after your guess (Q) Sorry, you did not win that round Press any key to continue . . .

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

=+from: a) a MNEs perspective? and b) the HRM managers perspective?

Answered: 1 week ago