0
   

Help Please? Computer Programming Homework!!!?

 
 
Reply Wed 9 Oct, 2013 08:38 am
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;
}
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 639 • Replies: 1
No top replies

 
karma2you
 
  1  
Reply Wed 9 Oct, 2013 09:23 am
@karma2you,
Edit my around code:

#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();

//The function returns 1 if the guess matches the solution and returns a 0 if they do not match
char guess();

int main()
{
char answer;

Instructions()


//1. Greet the user and ask if they would like to play a guessing game.
printf("\nHello there! Would like to play a guesssing game?Enter Y or N: \n");
scanf(" %c", &answer);
printf("\n answer is %c\n", answer);
while (answer == 'Y'){

printf("You entered Y. Let's play!");

printf("\nDo you want to play again? Y or N: \n");
scanf(" %c", &answer);
printf("\n answer is %c\n", answer);

}
printf("GoodBye!");
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("I have a capital letter in mind. You have 6 chances to guess which letter I am thinking. I will let you know if you are too high or too low\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.


//get the guess from the user (call getLetter function)


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;

}
0 Replies
 
 

 
  1. Forums
  2. » Help Please? Computer Programming Homework!!!?
Copyright © 2026 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/27/2026 at 02:35:17