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

上一篇:js 实现 C# 的 format 方法


下一篇:prometheus监控系统