_056_根据年份判断十二生肖

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;

namespace _056_根据年份判断十二生肖
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Globalization.ChineseLunisolarCalendar chineseCaleander =new System.Globalization.ChineseLunisolarCalendar();
            string TreeYear = "鸡狗猪鼠牛虎兔龙蛇马羊猴";
            //string TreeYear = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
            //int intYear = chineseCaleander.GetSexagenaryYear(DateTime.Now);
            int intYear = DateTime.Now.Year % 12;
            //intYear = 12;
            string Tree = TreeYear.Substring(chineseCaleander.GetTerrestrialBranch(intYear) - 1, 1);
            //利用IsLeapYear()判断本年度是不是闰年
            bool P_b1 = DateTime.IsLeapYear(int.Parse(DateTime.Now.ToString("yyyy")));
            if (P_b1)
                Console.WriteLine("半年都是闰年");
            else
                Console.WriteLine("本年度是平年");
            //利用DaysInMonth()方法找出本月的天数;
            Console.WriteLine("本月的天数为{0}天。", DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));
            //显示今天是星期几
            Console.WriteLine(DateTime.Now.ToString("dddd"));
            
            Console.WriteLine("今年是十二生肖" + Tree + "");
            MessageBox.Show("今年是十二生肖" + Tree + "", "判断十二生肖", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Console.ReadKey();
        }
    }
}

posted on 2019-04-05 23:54  援手  阅读(428)  评论(0编辑  收藏  举报