zoukankan      html  css  js  c++  java
  • c#基础 第三讲

                Random r = new Random();                 string x, y;             while (true)             {                                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 = "耍赖";                         break;                 }                 switch (b)                 {                     case 0://剪刀                         y = "剪刀";                         break;                     case 1://石头                         y = "石头";                         break;                     case 2://布                         y = "布";                         break;                     default:                         y = "耍赖";                         break;                 }

                    Console.WriteLine("x出的是" + x);                 Console.WriteLine("y出的是" + y);                 string jg = "";                                if (a == b)                 {                     jg = "平局";                 }                 else if ( a > b)                 {                     if (a==2&&b==0)                     {                         jg = "y胜利";                     }                     else                     {                         jg = "x胜利";                     }                                     }                 else if (b > a)                 {                     if (b == 2 && a == 0)                     {                         jg = "x胜利";                     }                     else                     {                         jg = "y胜利";                     }                 }

                    Console.WriteLine(jg);

                    Console.ReadLine();             }

  • 相关阅读:
    字符串旋转词、句子逆序化、字符串移位、最小字典序字符串问题
    字符串匹配算法——BF、KMP、Sunday
    字符串问题简述与两个基本问题的Java实现——判断二叉树拓扑结构关系与变形词
    PowerDesigner使用笔记
    SpringMVC学习笔记八:文件上传下载(转)
    小程序实现原理解析
    Flink流处理之迭代案例
    关于“淘宝爆款”的数据抓取与数据分析
    基于内容的推荐 java实现
    qt坐标系统与布局的简单入门
  • 原文地址:https://www.cnblogs.com/Kare/p/4307281.html
Copyright © 2011-2022 走看看