For this code im getting some errors that i can't figure out why its failing to compile. most of the errors are on line 37 85 and 101. Can someone please help figure out what im doing wrong?
Code:
#define_CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<ctype.h>
#defineMAXGUESSES 5
//this function provides instructions to the user on how to play the game
void Instructions();
//this function runs one game. It for checks either 5 incorrect guesses or correct guess.
//It returns a 0 if the game is over and the player did not guess the letter, otherwise it returns 1.
int PlayGuess(char solution);
//this function prompts the player to make a guess and returns that guess
//this function is called from inside the PlayGuess( ) function described above
char GetLetter();
//this function takes two arguments, the guess from the player
//and the solution letter from the file.
//It lets the user know if the guess comes alphabetically before or after the answer
//The function returns 1 if the guess matches the solution and returns a 0 if they do not match
int CompareLetters(char guess, char solution);
int main()
{
int i = 0;
int numgames = 0;
char solution;
char guess;
int compareletter(char guess, char solution);
FILE *inp;
inp = fopen_s("inputLet.txt", "r");
fscanf(inp, "%c", &solution);
Instructions();
//get number of games the user wants to play
printf("Please enter the number of games you want to play\n");
scanf("%d", &numgames);
for (i = 1; i <= numgames; i++)
//print current game (value of i)
{
//get letter to guess from file
fscanf(inp, "%c", &solution);
PlayGuess(solution);
printf("\nThe letter is %c\n", solution);
}
fclose(inp);
}
void Instructions()
{
printf("Welcome to Letter Guess\n");
printf("To begin you will enter the number of games you want to play(1 – 4 games)\n");
printf("You have 5 chances to guess each letter\n");
printf("Let's begin\n");
}
int PlayGuess(charsolution) //player defined guesses.
{
//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
//this function lets the user know if they have won or lost the game
void GuessTheLetter(char solution); {
int win = 0;
int numGuesses = 0;
//declare additional variables 1. number of guesses 2. Win or Lose
int numGuess = 0;
int WorL = 0;
while (numGuesses < MAXGUESSES && win == 0) {
//get a guess from the user by calling the GetTheGuess function
GetTheGuess();
//change the guess to lowercase
int letter = tolower(solution);
//win = call the function to compare the guess with the solution
numGuesses++; //count the number of guesses so far
}
//use conditions to let the user know if they won or lost the round of the game
}
//this function provides instructions to the user on how to play the game
void GameRules(); {
printf("Welcome to the letter guessing game!");
printf("\nYou have the options to play 1-8 rounds of this game.");
printf("\nTo begin, you will have a total of 5 guesses per letter in every game.\n");
return;
}
}
//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 GetLetter() {
char guess;
printf("Enter a letter as your guess: \n");
scanf("\n%c", &guess);
printf("The letter you chose is %c\n", guess);
return guess;
}
//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 guess, char solution) {
char value;
if (guess > solution)value = 0;
else value = 1;
printf("");
return 0;
}