c# 之五行地支
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace 求余数 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int years = int.Parse(this.textBox1.Text); this.textBox2.Text = (years % 12).ToString(); switch (this.textBox2.Text) { case "4": this.label4.Text = "子-五行:阳水"; break; case "5": this.label4.Text = "丑-五行:阴土"; break; case "6": this.label4.Text = "寅-五行:阳木"; break; case "7": this.label4.Text = "卯-五行:阴木"; break; case "8": this.label4.Text = "辰-五行:阳土"; break; case "9": this.label4.Text = "巳-五行:阴火"; break; case "10": this.label4.Text = "午-五行:阳火"; break; case "11": this.label4.Text = "未-五行:阴土"; break; case "0": this.label4.Text = "申-五行:阳金"; break; case "1": this.label4.Text = "酉-五行:阴金"; break; case "2": this.label4.Text = "戌-五行:阳土"; break; case "3": this.label4.Text = "亥-五行:阴水"; break; } } } }
子 阳水 4
丑 阴土 5
寅 阳木 6
卯 阴木 7
辰 阳土 8
巳 阴火 9
午 阳火 10
未 阴土 11
申 阳金 0
酉 阴金 1
戌 阳土 2
亥 阴水 3
甲 阳木 4
已 阴木 5
丙 阳火 6
丁 阴火 7
戊 阳土 8
己 阴土 9
庚 阳金 0
辛 阴金 1
壬 阳水 2
葵 阴水 3