zoukankan      html  css  js  c++  java
  • 利用switch case 来运行咱们结婚吧

    static void Main(string[] args)
            {
                while (true)
                {
                    int x, y,z; string a, b,c;
                    Random r=new Random();                       //这个是用的随机数随机生成,并且利用switch case赋予x,y,z成为"剪刀"石头""布""的含义。
                    x = r.Next(0, 2);                                     //注意switch case 要与break连用。
                    y = r.Next(0, 2);
                    z = r.Next(0, 2);
                    switch (x)
                    {
                        case 0:
                            a = "有房";
                            break;
                        case 1:
                            a = "没房";
                            break;
                        default:
                            a = "康康";
                            break;
                    }
                    switch (y)
                    {
                        case 0:
                            b = "有车";
                            break;
                        case 1:
                            b = "没车";
                            break;
                        default:
                            b = "康康";
                            break;
                    }
                    switch (z)
                    {
                        case 0:
                            c = "有钱";
                            break;
                        case 1:
                            c = "没钱";
                            break;
                        default:
                            c = "康康";
                            break;
                    }
                    Console.WriteLine(a);
                    Console.WriteLine(b);
                    Console.WriteLine(c);
                    if (x == 0 && y == 0 & z == 0)
                    {
                        Console.WriteLine("来结婚吧!!");
                    }

                     else if (x == 0 && y == 1 & z == 1)
                        {
                            Console.WriteLine("车钱都没有,等你有实力买了车再来把");
                        }
                     else if (x == 0 && y == 0 & z == 1)
                        {
                            Console.WriteLine("没钱跟着你喝西北风啊!!");
                        }
                     else if (x == 1 && y == 0 & z == 1)
                        {
                            Console.WriteLine("买了房子再说不然住车上吗");
                        }
                        else if (x == 0 && y == 1 & z == 0)
                        {
                            Console.WriteLine("上班想让我坐公交是不是?");
                        }
                    else if (x == 1 && y == 0 & z == 0)
                    {
                        Console.WriteLine("没房住哪儿");
                    }
                       else
                       {
                        Console.WriteLine("下一个");
                       }

                  
                   
                   
                   
                   
                   
                    Console.ReadLine();
                }

  • 相关阅读:
    How to convert VirtualBox vdi to KVM qcow2
    (OK)(OK) adb -s emulator-5554 shell
    (OK)(OK) using adb with a NAT'ed VM
    (OK) How to access a NAT guest from host with VirtualBox
    (OK) Creating manually one VMs from an existing VDI file in CLI (VBoxManage) in Fedora 23
    (OK)(OK) Creating VMs from an existing VDI file in CLI (VBoxManage) in Fedora 23
    (OK) Creating_VMs_from_an_existing_VDI_file.txt
    (OK) Creating VMs from an existing VDI file —— in OS X
    (OK) install_IBM_SERVER.txt
    (OK) install chrome & busybox in android-x86_64 —— uninstall chrome
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4374271.html
Copyright © 2011-2022 走看看