/*烟台大学计算机学院学生
*All right reserved.
*文件名称:C#-—猜数字
*作者:杨飞
*完成日期:2014年9月2日
*版本号:v1.0
*对任务及求解方法的描述部分:C#-—猜数字
*我的程序:*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
Random rd = new Random();
int x = rd.Next(100);
while (true)
{
int n = int.Parse(Console.ReadLine());
if (n > x)
{
Console.WriteLine("大了,请重新输入");
}
else if (n < x)
{
Console.WriteLine("小了,请重新输入");
}
else
{
Console.WriteLine("恭喜你答对了!");
break;
}
}
;
Console.ReadKey();
}
}
}
运行结果:
心得体会:呵呵