namespace lianxi6._29_1
{
class Program
{
static void Main(string[] args)
{
Random r =new Random();
int b =r.Next(0, 100);
int count= 1;
Console.ReadLine("请输入您猜的数字:");
cc:
int a =int.Parse(Console.ReadLine());
f(a,b);
if (a ==b) { Console.Write("您猜对了,用了{0}次",count); }
count++;
gotocc;
Console.ReadLine();
}
static void f(int a,int b)
{
if (a >b)
{
Console.Write("您猜的数大了n");
}
else if (a< b)
{
Console.Write("您猜的数小了n");
}
}
}
}
C#实现猜数游戏
最新推荐文章于 2022-11-19 15:07:07 发布