Hey guys!
I was trying to write a console program, which generates a random number, and the user needs to guess the number. Here is my code, it won't work for some reason.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _20110816
{
class Program
{
static void Main(string[] args)
{
int number, tip, success=0;
Random r = new Random(100);
number = r.Next(100);
Console.Write("Your PC has thought out a number. Give a tip:");
while (success == 0)
{
tip = Convert.ToInt32(Console.Read());
if(tip == number)
{
Console.Write("Success! Your tip is correct");
success++;
}
if(tip < number) Console.Write("Your tip should be bigger.");
if(tip > number) Console.Write("Your tip should be smaller.");
}
Console.ReadKey();
}
}
}
Thanks!
