Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will code a C program that is a letter guessing game. The user can pick between 1-8 games to play. The program will read

You will code a C program that is a letter guessing game. The user can pick between 1-8 games to play. The program will read the letter from an input file for each game. The user will try to guess the letter and has 1-8 tries to guess it correctly. After which, the game ends and the next one begins. Instructions: Write a program that reads letters from a file called letterList.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 letterList.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 lowercase o Use the function tolower 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 4 user defined functions as follows: o No modifications may be made the to 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 GameRules();

//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 GuessTheLetter function void GuessTheLetter(char);

//this function prompts the player to make a guess and returns that guess

//this function is called from inside the GuessTheLetter( ) function described above char GetTheGuess();

//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 CompareLetters(char, char);

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

Students also viewed these Databases questions

Question

Explain the different types of marketing strategies.

Answered: 1 week ago

Question

Explain product positioning.

Answered: 1 week ago

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago