[solved]-Need Help C Program Cannot Get Compile Use Microsoft Studio Compiler Course S Word Game St Q39090420
Need help with this C program?
I cannot get it to compile. I have to use Microsoft Studiocompiler for my course.
It’s a word game style program and I can’t figure out where theissue is.
* Program *
// Michael Paul Laessig, 07 / 17 / 2019.
/*COP2220 Second Large Program (LargeProg2.c).*/
#define _CRT_SECURE_NO_DEPRECATE
//Include the following libraries in the preprocessor directives:stdio.h, string.h, ctype.h
#include <stdio.h> /*printf, scanf definitions*/
#include <string.h> /*stings definitions*/
#include <ctype.h> /*toupper, tolower definitions*/
#define MAXGUESSES 5
#define WORDSIZE 25
// Function Prototypes.
void GameRules(void);
void LowerCaseWord(char word[WORDSIZE]);
void CreateSecretWord(char solution[WORDSIZE], charsecretword[WORDSIZE]);
void PlayOneGame(char solution[WORDSIZE], charsecretword[WORDSIZE]);
void GetTheLetterGuess(char lettersGuessed[WORDSIZE], char*letterPtr, int *numPtr);
void ReplaceDash(char solution[WORDSIZE], charsecretword[WORDSIZE], char letter);
void DidYouWin(char solution[WORDSIZE], charguess[WORDSIZE]);
void PlayAgain(int *againPtr);
int main(void)
{
char solution[WORDSIZE], secretword[WORDSIZE];
int again = 1;
printf(“Welcome to the word guessing game!n”);
GameRules();
FILE *WordGame;
WordGame = fopen(“inputWords.txt”, “r”);
if(WordGame != NULL) {
do {
fscanf(WordGame, “%s”, word);
LowerCaseWord(solution);
CreateSecretWord(solution,secretword);
PlayOneGame(solution,secretword);
PlayAgain(&again);
} while (again == 1);
fclose(WordGame);
else {
printf(“Unable to open file inputWords.txt”);
}
return 0;
}
// Function Definitions.
//this function provides instructions to the user on how to playthe game
void GameRules(void) {
printf(“nIn this game you will try to guess theSecret Word.n”);
printf(“nYou will guess each character of the SecretWord one at a time.n”);
printf(“nYou will be allowed a maximum of 5guesses.n”);
printf(“nYou will be notified of each correctguess.n”);
printf(“nYou will be also notified of each incorrectguess.n”);
printf(“nEach correct guess will reveal part of theSecret Word piece by piece.n”);
printf(“nThe game will continue until either you haveguessed the Secret Word,”);
printf(“or you have exhausted all 5 of yourguesses.n”);
printf(“nAt such time you will be allowed to eithertry your luck again,”);
printf(“or discontinue playing and exit thegame.n”);
}
//this function changes a character array to all lowercaseletters
void LowerCaseWord(char word[WORDSIZE]) {
int i, length_A;
length_A = strlen(word);
for (i = 0; i < length_A; i++) {gbv43r
word[i] = tolower(word[i]);
}
}
//this function creates the secret word array that is alldashes
void CreateSecretWord(char solution[WORDSIZE], charsecretword[WORDSIZE]) {
int j, length_B;
length_B = strlen(solution);
for (j = 0; j < length_B; j++) {
secretword[j] = ‘-‘;
}
secretword[j] = ”;
}
// this function runs one round of the game
//input: solution word from the file and the secret word made ofdashes
//void return type
//all other functions to Play one round of a game
//are called from within the PlayOneGame function
void PlayOneGame(char solution[WORDSIZE], charsecretword[WORDSIZE]) {
char lettersGuessed[WORDSIZE],word[WORDSIZE];
char letter;
int count, k;
printf(“nOkay lets begin!n”);
printf(“nThe Secret Word is: “);
for (k = 0; k < strlen(secretword); k++) {
printf(“%c”, secretword[i]);
printf(“n”);
}
for (count = 0; count < MAXGUESSES; count++){
printf(“n———————————————n”);
GetTheLetterGuess(lettersGuessed,&letter, &count);
ReplaceDash(solution, secretword,&letter);
}
printf(“nNow enter your guess for the word: “);
scanf(“%s”, word);
DidYouWin(solution, word);
}
//this function gets the users guess letter
//changes it to lowercase
//and adds it to the lettersGuessed array
void GetTheLetterGuess(char lettersGuessed[WORDSIZE], char*letterPtr, int *numPtr) {
printf(“nNow make a letter guess: “);
scanf(” %c”, letterPtr);
*letterPtr = tolower(*letterPtr);
letterGuessed[*numPtr] = *letterPtr;
}
//this function replaces any dash in the secretword with thecurrent character entered by the user
//this function will let the user know if the letter was in theword
void ReplaceDash(char solution[WORDSIZE], charsecretword[WORDSIZE], char letter) {
int l, found;
for (l = 0; l < strlen(solution); l++) {
if (solution[l] == letter) {
found = 1;
}
}
if (found) {
printf(“nThe letter %c was presentin the secret word”, letter);
}
else {
printf(“nThe letter %c was notpresent in the secret word”, letter);
}
printf(“nThe Secret Word is: “);
for(l = 0; l < strlen(secretword); l++)
printf(“%c”,secretword[l]);
printf(“n”);
}
//this function compares the solution and the guess word
//tells the user if they have correctly guessed the word
void DidYouWin(char solution[WORDSIZE], char guess[WORDSIZE]) {
int comp_2;
comp_2 = strcmp(solution, guess);
if (comp_2 == 0) {
printf(“nYou guessed the SecretWord correctly!n”);
printf(“nThe Secret Word was: %s”,solution);
printf(“n”);
}
else {
printf(“nSorry you guessed theSecret Word incorrectly…n”);
printf(“nThe Secret Word was: %s”,solution);
printf(“n”);
}
}
//this function asks the user if they want to play another game(1 to continue, 0 to Quit)
void PlayAgain(int *againPtr) {
printf(“nDo you wish to play again?n”);
printf(“nEnter the number 1 for Yes and the number 0for No.n”);
scanf(” %d”, againPtr);
}
* End of Program *
Expert Answer
Answer to Need help with this C program? I cannot get it to compile. I have to use Microsoft Studio compiler for my course. It’s a… . . .
OR

