加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

_056_根据年份判断十二生肖

发布时间:2020-12-14 02:52:08 所属栏目:Windows 来源:网络整理
导读:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; //在控制台应用程序中调用MessageBox函数需要在资源管理中引用system.windows.forms; using System.Windows.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
//在控制台应用程序中调用MessageBox函数需要在资源管理中引用system.windows.forms;
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 = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
       //此处两种方法,一种方法是采用chineseCaleander类进行计算,另一种直接除以12取余,如果余数为1则为鸡年,依次类推;
//int intYear = chineseCaleander.GetSexagenaryYear(DateTime.Now); int intYear = DateTime.Now.Year % 12; string Tree = TreeYear.Substring(chineseCaleander.GetTerrestrialBranch(intYear) - 1,1); Console.WriteLine("今年是十二生肖" + Tree + ""); MessageBox.Show("今年是十二生肖" + Tree + "","判断十二生肖",MessageBoxButtons.OK,MessageBoxIcon.Information); } } }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读