コード例 #1
0
ファイル: Problem019.cs プロジェクト: pedroliska/relue
        public static void Run()
        {
            Timer.RecordMiliseconds(() =>
            {
                var day = new CalendarDay(DayOfWeek.Tuesday, 1901, Month.January, 1);
                //var day = new CalendarDay(DayOfWeek.Saturday, 1904, Month.February, 28);
                int sundayCount = 0;
                do
                {
                    //Console.WriteLine(day);
                    if (day.DayOfWeek == DayOfWeek.Sunday && day.DayOfMonth == 1)
                    {
                        sundayCount++;
                    }
                    day = day.NextDay();
                } while (day.Year < 2001);

                Console.WriteLine("The 20th century had {0} sundays that fell on the first of the month", sundayCount);
            });
        }
コード例 #2
0
ファイル: Problem019.cs プロジェクト: pedroliska/relue
        public static void Run()
        {
            Timer.RecordMiliseconds(() =>
            {
                var day = new CalendarDay(DayOfWeek.Tuesday, 1901, Month.January, 1);
                //var day = new CalendarDay(DayOfWeek.Saturday, 1904, Month.February, 28);
                int sundayCount = 0;
                do
                {
                    //Console.WriteLine(day);
                    if (day.DayOfWeek == DayOfWeek.Sunday && day.DayOfMonth == 1)
                        sundayCount++;
                    day = day.NextDay();
                } while (day.Year < 2001);

                Console.WriteLine("The 20th century had {0} sundays that fell on the first of the month", sundayCount);
            });
        }
コード例 #3
0
ファイル: Problem019.cs プロジェクト: pedroliska/relue
 public CalendarDayGenerator(CalendarDay firstDayToGenerate)
 {
     _firstDayToGenerate = firstDayToGenerate;
 }
コード例 #4
0
ファイル: Problem019.cs プロジェクト: pedroliska/relue
 public CalendarDayGenerator(CalendarDay firstDayToGenerate)
 {
     _firstDayToGenerate = firstDayToGenerate;
 }