Putting+it+all+together+(guessing+game)

=Guessing Game= <-- Prev - Contents - Next -->

The Guessing Game should bring together everything you have learned in the previous lessons.

To see an example of this program, download this and give it a try.

Code that you will need:

 * Random Number Generator
 * While-Loops
 * If-Statements
 * System.Console.WriteLine
 * System.Console.ReadLine
 * Conversion from string to integer

Variables to consider:

 * user input
 * random number
 * counter variable

Random Number Generator
You will need a few lines of code to generate a random number: code format="csharp" Random random = new Random; int my_number = random.Next(0, 100); //returns a number between 0 and 100 code

Go ahead and create your own guessing game program. Name the project GuessingGame. Try to make the output as close as possible to the sample program provided above. Remember, the general flow of the program will be something like this:
 * 1) Create a random number (the answer).
 * 2) Ask the user for input
 * 3) Convert the input from a string to an integer
 * 4) Compare the input to the random number
 * 5) Output "higher" or "lower" (and repeat) if NOT equal
 * 6) If equal, ask user if they want to play again
 * 7) Quit if they don't... otherwise, start over.

Have fun!

<-- Prev - Contents - Next -->