• 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();             }

  • 相关阅读:
    Html-Css 从入门到放弃(一)基础知识
    PHP7 学习笔记(十)会话控制
    Redis模块学习笔记(一)RediSearch简单使用
    PHP7 学习笔记(九)phpsize动态编译openssl扩展 (微信公众平台)
    Git与GitHub学习笔记(五)一次提交失败的记录
    PHP7 学习笔记(八)JetBrains PhpStorm 2017.1 x64 MySQL数据库管理工具的使用
    PHP7 学习笔记(七)如何使用zephir编译一个扩展记录
    阿里云(四)Linux 实例常用内核网络参数介绍与常见问题处理
    阿里云(三)安全组
    流媒体技术学习笔记之(十七)FFmpeg 3.3《希尔伯特》-新版本的亮点
  • 原文地址:https://www.cnblogs.com/Kare/p/4307281.html
Copyright © 2020-2023  润新知