Пример #1
0
    public static void Main()
    {
        // Creates and initializes a JulianCalendar.
        JulianCalendar myCal = new JulianCalendar();

        // Creates a holder for the last day of the second month (February).
        int iLastDay;

        // Displays the header.
        Console.Write("YEAR\t");
        for (int y = 2001; y <= 2005; y++)
        {
            Console.Write("\t{0}", y);
        }
        Console.WriteLine();

        // Checks five years in the current era.
        Console.Write("CurrentEra:");
        for (int y = 2001; y <= 2005; y++)
        {
            iLastDay = myCal.GetDaysInMonth(y, 2, JulianCalendar.CurrentEra);
            Console.Write("\t{0}", myCal.IsLeapDay(y, 2, iLastDay, JulianCalendar.CurrentEra));
        }
        Console.WriteLine();

        // Checks five years in each of the eras.
        for (int i = 0; i < myCal.Eras.Length; i++)
        {
            Console.Write("Era {0}:\t", myCal.Eras[i]);
            for (int y = 2001; y <= 2005; y++)
            {
                iLastDay = myCal.GetDaysInMonth(y, 2, myCal.Eras[i]);
                Console.Write("\t{0}", myCal.IsLeapDay(y, 2, iLastDay, myCal.Eras[i]));
            }
            Console.WriteLine();
        }
    }