zoukankan      html  css  js  c++  java
  • 剪刀石头布编辑

    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胜利");                 }             }

  • 相关阅读:
    js处理json数据,java处理json数据
    sqlmap中##和$$的区别
    tar.gz和bin,以及rpm,deb等linux后缀的文件的区别
    ibatis内置类型
    1099端口被占问题
    动态代理与静态代理的区别
    条款36:绝不重新定义继承而来的non-virtual函数(Never redefine an inherited non-virtual function)
    条款35:考虑virtual函数以外的其他选择(Consider alternative to virtual functions)
    条款34:区分接口继承和实现继承(Different between inheritance of interface and inheritance of implemenation)
    工作好习惯(18之后)
  • 原文地址:https://www.cnblogs.com/shitouge/p/4307556.html
Copyright © 2011-2022 走看看