using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { Console.Write("请输入(0 || 1 || 2分别代表剪刀||锤|| 布):"); int a = int.Parse(Console.ReadLine()); Random r = new Random(); int PC = r.Next(3); Console.WriteLine("电脑为{0}", PC); if (a < 0 || a >= 3) { Console.WriteLine("请输入正确的数字!"); } else if (a == 2 &&PC ==0) { Console.WriteLine("你输了,真遗憾!"); } else if (PC == 2 && a == 0) { Console.WriteLine("你赢了,好棒!"); } else { if (a == PC) { Console.WriteLine("打平了,请继续努力!"); } else if (a > PC) { Console.WriteLine("你赢了,好棒!"); } else { Console.WriteLine("你输了,真遗憾!"); } } Console.ReadLine(); } } } }