Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a simple guessing game in C. Here is how we play this game: Think of a

ID: 3638625 • Letter: I

Question

Implement a simple guessing game in C.
Here is how we play this game:
Think of a number between 1 and 100 in your mind. Then, your program should ask you minimal # of questions and determine your number based on your answers. Program's question format will be
Is it NN (<, =, >)?
You can respond to that question in 3 ways: < indicates that your number is less than computer's guess, = means that program guessed your number right, and > means that your number is greater than computer's guess.
Allow the user to play this game any number of times.
When the user is ready to quit, output average # of guesses / game.
Implementation guidelines:
Use a separate function to play the game.
Invoke that function from main() repeatedly as needed.

Explanation / Answer

#include #include #include main() { int close; int repete = 1; int target = 1; int input; while (repete = 1) { target = genrand(1, 1000); printf("Pick a number between 1 and 1000 "); scanf("%d", &input); if (input target) { printf("Lower than %d "), input; } if (input == target) { printf("Correct! The correct number was %d! "), input; printf("Press a key then hit enter to exit the program "); scanf("%d", &close); return 0; } } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote