Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

this is the outline: #define _CRT_SECURE_NO_WARNINGS *Please do only one step at

ID: 3732028 • Letter: T

Question

this is the outline: #define _CRT_SECURE_NO_WARNINGS *Please do only one step at a time and do not move onto the next step until you have compiled and tested the current step Download the letterGuess.exe file and letters.txt file to play a few rounds of the game (YOU MAY NEED TO CONNECT TO THE ENGINEERING STUDENT DESKTOPS TO TRY IT 1. create a project and name the source code letterGuess.c 2. use the sample letterGuessOutline as a guide, copy/ paste into your project source code build run and test, the outline code should compile and execute 3. add the function prototype and implement the function definition for the LetterGuessRules function 4. add the function call to LetterGuessRules in the main function build run and test 5. Notice that the numGames variable is set to 3. 6. add the function prototype and implement the function definition for the GameCount function 7. add the function call to GameCount in the main function 8. print numGames onto the screen to test build run and test PASTE THE CURRENT VERSION OF YOUR CODE HERE (only steps 1-8 completed) 9. go to the assignment and save letters.txt into the same directory as letterGuess.c (remember to use your Z drive on portal.eng.fau.edu) 10. declare a file pointer variable, connect to the input file and use fscanf to read the letters one by one from the file (fopen is before the for loop, fscanf is inside the for loop) 11 . Remember to add the space in fscanf for %C

Explanation / Answer

Hi Student

Please find the solution below :

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

#include <ctype.h>

#define MAXGUESSES 5

#define BLOCK 1000

void letterGuessRules()

{

printf(" ......GAME ....... ");

printf("You will have to select number of games you wana play. Then each game will prompt you to choose a character. You can have maximum 5 guesses. Based on your slection you will either win or loss");

}

int gameCount(){

int total =0;

printf(" Enter the number of games you want to play between 1 -8 : ");

scanf("%d",&total);

return total;

}

int compareGuessAndSolution(char guess, char solution){

if(toupper(guess) == toupper(solution))

return 1;

else

return 0;

}

char getGuess(){

char guess ;

printf(" Guess your character : ");

scanf(" %c",&guess);

return guess;

}

void playOneGame(char solution){

int start;

char guess;

for(start=0;start<MAXGUESSES;start++){

guess = getGuess();

if(compareGuessAndSolution(guess,solution)==1){

printf(" Its a Win..! Yes you guessed the right character");

break;

}

else

printf(" No its not correct");

}

if(start == MAXGUESSES)

printf(" Its a loss..! The character you were guessing is : %c",solution);

}

int main(){

int start=0,i;

FILE *fp;

fp = fopen("letters.txt","r");

char c;

  

letterGuessRules();

int total = gameCount();

for( start =0 ; start < total ; start++) {

while((c= fgetc(fp))!=EOF){

printf(" Lets start Game # %d",(start+1));

char solution = c;

playOneGame(solution);

break;

}

}

printf(" Game Over..!!!! ");

  

}

If you have any doubt or need any clarification, please revert back.Would be happy to help.

And if you like this answer, please give a thumbs up!