Question: I need help to finish my program, this is what I have so far //precompiler directives #define_CRT_SECURE_NO_WARNINGS //to avoid scanf warning or error #include //printf,

I need help to finish my program, this is what I have so far

I need help to finish my program, this is what I haveso far //precompiler directives #define_CRT_SECURE_NO_WARNINGS //to avoid scanf warning or error #include//printf, scanf definitions #include #include #defineMAXGUESSES6 // Function prototypes voidHangmanRules(); voidPlayAgain(char*againPtr); voidPlayOneGame(charsolution[]);

//precompiler directives

#define_CRT_SECURE_NO_WARNINGS //to avoid scanf warning or error

#include //printf, scanf definitions

#include

#include

#defineMAXGUESSES6

// Function prototypes

voidHangmanRules();

voidPlayAgain(char*againPtr);

voidPlayOneGame(charsolution[]);

voidUpperCaseWord(charletter[]);

voidCreateStarword(charstarword[], intlength);

charGetTheLetterGuess(charlettersGuessed[], int*numPtr);

intReplaceStars(charsolution[], charstarWord[], charletter);

intDidYouWin(charsolution[]);

intmain(void)

{//variable

inta;

charstar[80];

charletters[80];

charguesses[80];

charsolution[80];

charletter[80];

FILE*open;

open = fopen("hangmanWords.txt", "r+");

charagainPtr = 'y';

printf("WELCOME TO THE HANGMAN GAME! ");

HangmanRules();

do

{

fscanf(in, " %s", &solution);

PlayOneGame(solution);

printf(" %s", solution);

PlayAgain(&againPtr);

} while(againPtr != 'N');

fclose(open);

return0;

}

// Rules function

voidHangmanRules()

{

printf("Please read the instructions carefully ");

printf("--- You will have to guess a word ");

printf("--- You will guess the word one letter at a time ");

printf("--- You only have 6 incorect guesses ");

printf("--- After each correct guesses you will have a ");

printf(" chance to guess the complete word ");

printf("--- The game ends when you guess the word ");

printf(" correctly or you ran out of guesses ");

printf("HAVE FUN! ");

return;

}

// Play again function

voidPlayAgain(char*againPtr)

{

printf("Play another game ( Y or N )? ");

scanf(" %c", againPtr);

*againPtr= toupper(*againPtr);

return;

}

// Upper case function

voidUpperCaseWord(charletter[])

{

intallWord = strlen(word);

for(intx = 0; x

{

Letter[i] = toupper(Letter[i]);

}

return;

}

// Play one game function

voidPlayOneGame(charsolution[])

{

return;

}

// Starword function

voidCreateStarword(charstarword[], intlength)

{

return;

}

// Get the guess function

charGetTheLetterGuess(charlettersGuessed[], int*numPtr)

{

int;

return;

}

// Replace the star function

intReplaceStars(charsolution[], charstarWord[], charletter)

{

return;

}

// Did you win function

intDidYouWin(charsolution[])

{

return;

}

COP 2220 * Intro to C * Spring 2018* Programming Assignment ;3 Algorithm due on Monday, April 02, 2018 (11:59 PM) Program due on Monday, April 09, 2018 (11:59 PM) Submit p3Algorithm.txt and hangman.c Topics: User defined functions, character arrays, C style string member functions Synopsis: You will write an interactive C program that will allow a user to play the Hangman game ow to play the game: Allow the user to guess letters one character at a time At every stage of the game, the user should be able to view the current state of the "word in progress" (star word) and the list of "guessed letters" If a letter is correctly guessed the player is notified and the letter appears in its proper location in the "star word" array If a letter is not correct, the number of guesses is increased In ALL cases, the guessed letter should be added to the array for "guessed letters'" The user is allowed up to 6 incorrect guesses The round of the game will end when the user has either guessed the word correctly or has made 6 incorrect letter quesses If the player guesses the word correctly, the player is notified that they have won and the correct word is displayed If the player does not get the correct word, the player is notified that they have lost and the correct word is displayed When the game is over, the user should be allowed to play again without having to execute the program again. (The player will play again with the next word in the file) Instructions: You will read the word to be guessed from a file "words.txt" which should contain upper and lower case words You will use 4 character arrays o one for the "word to be guessed" (which comes from the input file) one for the "star word" (same length as the word to be guessed) one for all of the "guessed letters" one for the "user's guess" o remember to add the NULL character : ? . o . remember to add the NULL character: O, o Declare any additional variables needed At the beginning of each game . o word to be guessed array - start with an empty string Read a word from the file and store it in the word to be guessed array * word in progress array should be adjusted to the correct length (that is the same size as the word read from the file but consists only of* (asterisks) in the beginning (star word) o o guessed letters array should be empty a character is added with each guess COP 2220 * Intro to C * Spring 2018* Programming Assignment ;3 Algorithm due on Monday, April 02, 2018 (11:59 PM) Program due on Monday, April 09, 2018 (11:59 PM) Submit p3Algorithm.txt and hangman.c Topics: User defined functions, character arrays, C style string member functions Synopsis: You will write an interactive C program that will allow a user to play the Hangman game ow to play the game: Allow the user to guess letters one character at a time At every stage of the game, the user should be able to view the current state of the "word in progress" (star word) and the list of "guessed letters" If a letter is correctly guessed the player is notified and the letter appears in its proper location in the "star word" array If a letter is not correct, the number of guesses is increased In ALL cases, the guessed letter should be added to the array for "guessed letters'" The user is allowed up to 6 incorrect guesses The round of the game will end when the user has either guessed the word correctly or has made 6 incorrect letter quesses If the player guesses the word correctly, the player is notified that they have won and the correct word is displayed If the player does not get the correct word, the player is notified that they have lost and the correct word is displayed When the game is over, the user should be allowed to play again without having to execute the program again. (The player will play again with the next word in the file) Instructions: You will read the word to be guessed from a file "words.txt" which should contain upper and lower case words You will use 4 character arrays o one for the "word to be guessed" (which comes from the input file) one for the "star word" (same length as the word to be guessed) one for all of the "guessed letters" one for the "user's guess" o remember to add the NULL character : ? . o . remember to add the NULL character: O, o Declare any additional variables needed At the beginning of each game . o word to be guessed array - start with an empty string Read a word from the file and store it in the word to be guessed array * word in progress array should be adjusted to the correct length (that is the same size as the word read from the file but consists only of* (asterisks) in the beginning (star word) o o guessed letters array should be empty a character is added with each guess

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!