I dont want you to actually write the whole code for me. I would just like it if
ID: 3624685 • Letter: I
Question
I dont want you to actually write the whole code for me. I would just like it if someone gave me an idea of where/how to start. I cant seem to get it going.Thanks.
This will be a guessing game for the user. The user will only get 8 guesses to try and get the word.
Requirements:
1. Choose a secret word that you want the user to guess
2. Prompt the user for a guess
3. Each time they guess wrong
a. display their guess, tell them it’s wrong, and a display how many guesses they have left
b. prompt them for another guess
c. if they guess correctly, congratulate them
d. if they guess 8 times and they have not guessed correctly, the game is over
This has to be accomplished using while or for loops.
Explanation / Answer
I will give it to you in pseudo code, if that will help. Here is the basic program: string secret=? //your secret word string guess //the user's input int correct=0 //a boolean value int count=8 //the number of guesses allowed while(!correct AND count > 0){ output "Please enter your guess: " get input from user and store in guess string if (guess = secret){ count-- output "Your guess of is wrong, try again." output "Number of guesses remaining: ." } else { output "Congratulations, you guessed correctly!" correct = 1; } } if(!correct) output "Sorry, game over." exitRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.