Question
Create a C# program that plays guessing game using GUI. Your program should choose the number to be guessed by selecting an int random integer
Create a C# program that plays guessing game using GUI. Your program should choose the number to be guessed by selecting an int random integer in the range between 1 and 100. It should display the following text in a label:
I have a number between 1 and 100 can you guess my number?
Please enter your first guess.
A textbox should be used to input the guess. As each guess is input, the background color should change to red or blue. Red indicates that the users guess is too high, blue that the users guess is too low. Additionally, a label should display either too high or too low. Button GUESS should allow the user to keep guessing until they guess the correct number. Keep a count of the number of guesses. When the user guesses the correct number, display Correct! It took you N times to get it right., change the Forms background color to green and disable the TextBox.
Provide a button NEW GAME that allows the user to play the game again. When such a button is clicked, generate a new random number, change the background to default color and enable the textbox. to enable the user to re-start the game without re-running your application. Tie the GUESS button to the enter key and the NEW GAME button to the cancel key. Use the following code to generate a random number by constructing an object of the Random class:
Use the following code to generate a random number by constructing an object of the Random class:
Random r = new Random( );
int target = r.Next ( 0 , 101 );
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