C++ Code a program to reproduce Mary's clairvoyant test: Mary conjures up a random number 1-10 in her mind and commands the user to guess what it is. If the user’s guess is equal to (remember your double equal sign!) the conjured number, Mary 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). Example code: Mary is thinking of a number 1-10...Guess what it is!: 6 Sorry, that is incorrect. Play again? (y/n): y Mary is thinking of a number 1-10...Guess what it is!: 5 That is correct! Mary would like to hire you as a clairvoyant assistant. Play again? (y/n): n Press any key to continue . . .
Solution:
#include<iostream>
using namespace std;
#include<stdio.h>
int main()
{
char choice='y';
int random_number,user_guess;
do
{
//rand() generates numbers from 0
to 9 so we add 1 to make the range 1-10
random_number=rand()%10+1;
cout<<"Mary is thinking of a
number 1-10...Guess what it is!:";
cin>>user_guess;
if(random_number==user_guess)
cout<<"That is correct!";
else
cout<<"Sorry, that is incorrect.";
cout<<"\nPlay again? (y/n):
";
cin>>choice;
}while(choice!='n');
return 0;
}
Output:

C++ Code a program to reproduce Mary's clairvoyant test: Mary conjures up a random number 1-10...
(c++) Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” The program should use a loop that repeats until the user correctly guesses the random number. Be sure that your program...
In c# create a program that generates a random number from 1 to 1000. Then, ask the user to guess the random number. If the user's guess is too high, then the program should print "Too High, Try again". If the user's guess is too low, then the program should print "Too low, Try again". Use a loop to allow the user to keep entering guesses until they guess the random number correctly. Once they figure it, congratulate the user....
Write a python program that stores a random number from 0-99 in a variable named target (this part is provided). Note that target will not be further updated in the program. The program then accepts user input and stores it in a variable named guess. You may assume that the user only enters integers. The program ends when guess is equal to target otherwise the program continuously asks the user to provide a guess. Output Correct after x trial! when...
Lab #6 Number Guessing Game – Loops and Nested Loops Requirements: Design, develop, test, and submit a program for a Number Guessing game. The program will select a random number between 0 and 100, allow the user to try up to 10 times to guess the number, and tell the user if each guess is too high, too low, or correct. The actual game portion must be a function...you can use more than one function in your program. The amount...
Write a program C++ (Write comments for each code)Generate a number from 1 to 10, inclusive. Prompt the user to guess an integer number. If the guess is incorrect, indicate to the user whether it is too low or too high. Then, prompt the user to guess again. If the guess is correct, indicate the correct answer and how many tries it took the get the correct answer.
Write a game application that generates a random number between 1 and 1000 (inclusive) and prompts the user for a guess. Use the pseudorandom number generator, the Random class. When the user guesses the correct number, say so, and display how many guesses the user required to guess correctly. Allow the user to play multiple times by asking the user if the user wants to continue playing. Guess my number between 1 and 1000 => 500 Too high...
on python i need to code a guessing game. After the player has guessed the random number correctly, prompt the user to enter their name. Record the names in a list along with how many tries it took them to reach the unknown number. Record the score for each name in another list. When the game is quit, show who won with the least amount of tries. this is what i have so far: #Guess The Number HW assignment import...
(Microsoft Visual Source, C++, Course: CIS-5, Intro to
Programming)
Write a program that starts a player off with a bank of
$15.00. A coin will flip and randomly choose heads or tails.The
user will guess heads or tails to win. If the coin flip matches the
player's guess his bet will be doubled. It costs 1 dollar to play
and the program will bet that amount automatically each time as
long as there is the available bank amount.
Note: Do...
please c++ with functions *Modify the Guessing Game Write the secret number to a file. Then write each user guess and answer to the file. (on separate lines) Write the number of guesses to the file at the end of the game. After the game is finished, ask the user if they want to play again. If 'n' or 'N' don't play again, otherwise play again! NOTE: your file should have more than one game in it if the user...
This program will implement a simple guessing game... Write a program that will generate a random number between 1 and 50 and then have the user guess the number. The program should tell the user whether they have guessed too high or too low and allow them to continue to guess until they get the number or enter a 0 to quit. When they guess the number it should tell them how many guesses it took. At the end, the...