using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Calculate
{
class Program
{
static void Main(string[] args)
{
string num;
int x;
num = Console.ReadLine();
x = int.Parse(num);
Random ran = new Random();
int k = ran.Next(100);
while(k!=x)
{
if (k>x)
{
Console.WriteLine("您猜小了,请重新输入");
x = int.Parse(Console.ReadLine());
}
else if (k<x)
{
Console.WriteLine("您猜大了,请重新输入");
x = int.Parse(Console.ReadLine());
}
}
Console.WriteLine("恭喜您,猜对了!");
Console.WriteLine("正确答案是:{0}",k);
Console.ReadKey();
}
}
}
c#猜数字小游戏
最新推荐文章于 2024-04-28 17:05:37 发布