• 剪刀石头布编辑


    Random r = new Random();    

             string x, y;     

            int a = r.Next(0,3);        

             int b = r.Next(0, 3);            

             switch(a)            

    {  

                case 0: 

                        x="剪刀";       

                  break;              

                 case 1:               

                        x="石头";            

                  break;           

                  case 2:    

                        x="布";           

                   break;        

                default:           

              x="OY";            

             break;

                       }  

               switch (b)  

               {            

                  case 0:         

                y = "剪刀";         

                break;         

                case 1:          

               y = "石头";            

             break;         

            case 2:           

              y = "布";            

             break;                 

           default:          

              y="OY";            

             break;

                }          

       Console.WriteLine("x出的是"+x);      

        Console.WriteLine("y出的是"+y);       

          if (a==b)      

      {                 Console.WriteLine("平局");             }        

         else if (a > b)       

         {                 if (a == 2 && b == 0)          

          {                     Console.WriteLine("y胜利");                 }

       else          

           {                     Console.WriteLine("x胜利");                 }        

         }      

           else if (b > a)      

           {        

             if (a == 0 && b == 2)          

           {                     Console.WriteLine("x胜利");                 }          

           else            

         {                 Console.WriteLine("y胜利");                 }             }

  • 相关阅读:
    Sgu294He's Circles
    [HNOI2008]Card洗牌
    传球游戏
    [BZOJ1478]Sgu282 Isomorphism
    [POJ2154]Color
    [ZOJ1961]Let it Bead
    BZOJ1257 [CQOI2007]余数之和sum
    BZOJ1192 [HNOI2006]鬼谷子的钱袋
    BZOJ4614 [Wf2016]Oil
    BZOJ3209 花神的数论题
  • 原文地址:https://www.cnblogs.com/shitouge/p/4307556.html
Copyright © 2020-2023  润新知