Exemplo n.º 1
0
        static void test(int N)
        {
            person a = new person();

            a.money = N;
            a.changeBeerByMoney();
            while (a.cap > 3 || a.bottle > 1)
            {
                if (a.bottle > 1)
                {
                    a.changeBeerByBottle();
                }
                if (a.cap > 3)
                {
                    a.changeBeerByCap();
                }
            }
            Console.WriteLine($"可以喝{a.count}瓶啤酒");
        }