zoukankan      html  css  js  c++  java
  • _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();
            }
        }
    }
  • 相关阅读:
    一些开源工具软件
    被伤过的心还可以爱谁
    C函数检测CPU架构为LittleEndian或BigEndian
    C#打印(接录)
    C#Lambda表达式参考
    C#反射 创建对象,调用方法
    datagridview cell 验证事件
    我多想抱着你哭
    C#获取属性
    STM32的位操作的方法
  • 原文地址:https://www.cnblogs.com/yuanshou/p/10660524.html
Copyright © 2011-2022 走看看