Question
Code a program to reproduce Madame Esmereldas clairvoyant test: Mme. Esmerelda conjures up a random number 1-10 in her mind and commands the user to
Code a program to reproduce Madame Esmereldas clairvoyant test: Mme. Esmerelda conjures up a random number 1-10 in her mind and commands the user to guess what it is. If the users guess is equal to (remember your double equal sign!) the conjured number, Mme. Esmerelda extends a job offer as a clairvoyant assistant. Add a user-driven loop that allows the user to play repeatedly if desired (but your program should conjure a new random number with every loop iteration).
These steps from my teacher:
//0. create variables for random number and user guess (you have user guess but not the random number variable). Also seed the random number (which you are doing correctly already at the top of your program). //1. generate a random number and put it in an integer variable. You've seeded the random number but have not actually generated one. Also, the game is not fun if the number to guess is always 5, as you've coded it. It should be random every time. //2. display greeting and ask user for guess //3. You may keep your input validation loop here, which is correct, but that is not actually required in this assignment. //4. now make the decision with a simple if/else: //if user guess is equal to the random number //display \"that is correct\" message //else //display \"sorry, that is incorrect\" message ^We only need one simple if/else in this program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started