Exemplo n.º 1
0
    static void Main()
    {
        ByTwos ob = new ByTwos();

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

        Console.WriteLine("\nResetting");
        ob.Reset();

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

        Console.WriteLine("\nStarting at 100");
        ob.SetStart(100);

        for (int i = 0; i < 5; i++)
        {
            Console.WriteLine("Next value is " + ob.GetNext());
        }
    }
Exemplo n.º 2
0
    static void Main()
    {
        // Demonstrate int series.
        ByTwos <int> intBT = new ByTwos <int>(IntPlusTwo);

        for (int i = 0; i < 5; i++)
        {
            Console.Write(intBT.GetNext() + " ");
        }
        Console.WriteLine();

        // Demonstrate double series.
        ByTwos <double> dblBT = new ByTwos <double>(DoublePlusTwo);

        dblBT.SetStart(11.4);

        for (int i = 0; i < 5; i++)
        {
            Console.Write(dblBT.GetNext() + " ");
        }
        Console.WriteLine();

        // Demonstrate ThreeD series.
        ByTwos <ThreeD> ThrDBT = new ByTwos <ThreeD>(ThreeDPlusTwo);
        ThreeD          coord;

        for (int i = 0; i < 5; i++)
        {
            coord = ThrDBT.GetNext();
            Console.Write(coord.x + "," + coord.y + "," + coord.z + " ");
        }
        Console.WriteLine();
    }
    static void Main()
    {
        ByTwos ob = new ByTwos();

        Console.WriteLine("\nStarting at 100");
        ob.SetStart(100);

        for (int i = 0; i < 5; i++)
        {
            Console.WriteLine("Prev value is " + ob.GetPrevious());
        }
    }