using System;
public class Game
{
public static void Main(string[] args)
{
int selection;
Console.WriteLine("Please select Games:1.Guessing game;2.Finger guessing game;");
selection = Convert.ToInt32(Console.ReadLine());
long iSlc = 1;
switch (iSlc)
{
case 1:
Console.WriteLine("欢迎进入猜数字游戏!游戏规则:随机产生一个1~100之间的一个数,并由玩家进行猜测。\r\n提示玩家是猜大了还是猜小了或是猜对了。\n Good lucky yo tou!");
while (true)
{
Random rd = new Random();
int result = rd.Next(0, 100);//结果
Console.WriteLine("请请输入一个整数(范围为1~100)");
while (true)
{
int input = int.Parse(Console.ReadLine());
if (input == result)
{
Console.WriteLine("恭喜你,猜对了!");
break;
}
else if (input < result)
Console.WriteLine("猜小了!");
else
Console.WriteLine("猜大了!");
}
Console.WriteLine("是否继续,是请输入Y,否请输入N:");
char C = char.Parse(Console.ReadLine());
if (C == 'N')
break;
}
}
}
public class Game
{
public static void Main(string[] args)
{
int selection;
Console.WriteLine("Please select Games:1.Guessing game;2.Finger guessing game;");
selection = Convert.ToInt32(Console.ReadLine());
long iSlc = 1;
switch (iSlc)
{
case 1:
Console.WriteLine("欢迎进入猜数字游戏!游戏规则:随机产生一个1~100之间的一个数,并由玩家进行猜测。\r\n提示玩家是猜大了还是猜小了或是猜对了。\n Good lucky yo tou!");
while (true)
{
Random rd = new Random();
int result = rd.Next(0, 100);//结果
Console.WriteLine("请请输入一个整数(范围为1~100)");
while (true)
{
int input = int.Parse(Console.ReadLine());
if (input == result)
{
Console.WriteLine("恭喜你,猜对了!");
break;
}
else if (input < result)
Console.WriteLine("猜小了!");
else
Console.WriteLine("猜大了!");
}
Console.WriteLine("是否继续,是请输入Y,否请输入N:");
char C = char.Parse(Console.ReadLine());
if (C == 'N')
break;
}
}
}