示例#1
0
        public void Page_378()
        {
            ByTwos ob = new ByTwos();

            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("Next number equals " + ob.GetNext());
            }

            Console.WriteLine("Make reset.");
            ob.Reset();

            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("Next number equals " + ob.GetNext());
            }

            Console.WriteLine("Stand start number.");
            ob.SetStart(100);

            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("Next number equals " + ob.GetNext());
            }
        }
示例#2
0
        public void Page_382()
        {
            ByTwos twoOb   = new ByTwos();
            Primes primeOb = new Primes();

            ISeries ob;

            for (int i = 0; i < 5; i++)
            {
                ob = twoOb;
                Console.WriteLine("Next even number: " + ob.GetNext());

                ob = primeOb;
                Console.WriteLine("Next primes number: " + ob.GetNext());
            }
        }