▲直接就上吧沒有aspx頁面直接給各位c#的code
protected void Page_Load(object sender, EventArgs e)
{
int year = 1982;
//這是使用者輸入的西元年
int birthpet;
//宣告生肖要用的變數
birthpet = year % 12;
//西元年除12取餘數
birthpet = birthpet - 3;
//餘數-3
if (birthpet < 0)
birthpet = birthpet + 12;
//判斷餘數是否大於0,小於0必須+12
Response.Write("您為民國"+Convert.ToString(year-1911)+"年出生<p>");
Response.Write("生肖是"+Enum.GetName(typeof(chinese),birthpet));
//西元年減掉1911就是民國年這應該不用說明了吧=.=
}
enum chinese
{
鼠 = 1, 牛 = 2, 虎 = 3, 兔 = 4, 龍 = 5, 蛇 = 6, 馬 = 7, 羊 = 8, 猴 = 9, 雞 = 10, 狗 = 11, 豬 = 12
}


