• 猜拳游戏(三局两胜)


      //猜拳,剪刀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("三局两胜,很遗憾,您输了");
                  }
    

      

  • 相关阅读:
    spoj705
    bzoj2440
    spoj220
    bzoj2301
    hdu1695
    poj3294
    hdu3518
    poj3693
    函数
    样式
  • 原文地址:https://www.cnblogs.com/suncan0/p/4986538.html
Copyright © 2020-2023  润新知