This is the assignment I need some help with.
I have posted what i have written so far for this second assignment and am not sure what steps to take next, or if i have written it properly so far.
im using Microsoft's Visual C++ compiler
Below is the the instructions:
http://pastebin.com/a0cqG5w8
What I got so far:(not sure if it's right):
#include<stdio.h>
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#define MAXGUESSES 6
//this function provides instructions to the user on how to play the game
void instructions();
//this function runs one game. It for checks either 6 incorrect guesses or correct guess.
char play();
//this function prompts the player to make a guess and returns that guess
char getLetter();
char guess();
char solution();
int main()
{
int i = 0;
char guess;
char solution;
//display instructions
instructions();
//1. Greet the user and ask if they would like to play a guessing game.
printf("Hello there! would like to play a guesssing game?( Enter 'y' for yes and 'n' for no):");
printf("\nEnter Y or N: \n");
scanf(" %c", &answer);
printf("\n answer is %c\n", answer);
while (answer == 'Y'){
printf("Success!Let's play!");
scanf(" %c", &answer);
printf("\n answer is %c\n", answer);
}
printf("GoodBye!\n");
{
return 0;
}
}
//1. Greet the user and ask if they would like to play a guessing game.
//this function provides instructions to the user on how to play the game
void instructions()
{
printf("Hello, and Welcome to Letter Guess Game\n");
printf("To begin you will enter the number of games you want to play(6 games max)\n");
printf("You have 6 chances to guess each letter\n");
printf("The goal is simple; just keep guessing different letters between 'A' and 'Z' until you choose the correct one.\n");
printf("If the correct letter is chosen, the game is over and you have won!\n");
printf("If you fail to choose the correct letter after your 6th time, you lose.\n");
printf("After each guess, you will be informed if your guess is too high or too low. Good luck!\n");
printf("Okay, now lets begin:\n");
}
//player defined guesses.
char play()
{
char Letter = getLetter() // will contain the random letter
int count = 0; // keep track of the count
while(count != 6)
{
printf("Guess the word? ");
)
if(Letter > guess)
{
printf("To low");
count++;
}
else if(Letter < guess)
{
printf("To high");
count++;
}
else
{
printf("correct");
return W;
}
count++;
} // end while
return L;
}