private void button4_Click(object sender, EventArgs e)
{
string TreeYear = "猴鸡狗猪鼠牛虎兔龙蛇马羊";
int i = 2017;
int j = i % 12;
MessageBox.Show(j+ " " + TreeYear.Substring(j,1));
}
小结:
年份除以12取余,0为猴年,1为鸡年,以此类推。
private void button4_Click(object sender, EventArgs e)
{
string TreeYear = "猴鸡狗猪鼠牛虎兔龙蛇马羊";
int i = 2017;
int j = i % 12;
MessageBox.Show(j+ " " + TreeYear.Substring(j,1));
}
小结:
年份除以12取余,0为猴年,1为鸡年,以此类推。