标签:
//猜拳,剪刀0-1,石头-1, 布-2 int renying = 0; int dnying = 0; for (int i = 1; i <= 3; i++) { Random r = new Random(); int diannao = r.Next(3); Console.Write("请出拳;剪刀0-1,石头-1, 布-2 :"); int ren = int.Parse(Console.ReadLine()); Console.WriteLine("电脑出拳 :{0}", diannao); if (diannao - ren == -1 || ren - diannao == -2)//所有人赢得情况 { renying++; Console.WriteLine("恭喜您,您赢了"); } else if (diannao == ren) { Console.WriteLine("平局"); } else { dnying++; Console.WriteLine("很遗憾,您输了"); } } if (renying >= 2) { Console.WriteLine("三局两胜,恭喜您,您赢了"); } if (dnying >= 2) { Console.WriteLine("三局两胜,很遗憾,您输了"); }
标签:
原文地址:http://www.cnblogs.com/suncan0/p/4986538.html