English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

設計一個程式 輸入出生 年月日 會輸出甲子年與生肖

2006-05-01 16:21:39 · 3 個解答 · 發問者 阿峰 2 in 電腦與網際網路 程式設計

3 個解答

Private Sub Form_Activate()
a = InputBox("請輸入出生民國yy年(1~99)" & vbCrLf & "例如:77", "請輸入生出年份", 77)
If a = "" Then
MsgBox "請輸入資料"
a = InputBox("請輸入出生民國yy年(1~99)" & vbCrLf & "例如:77", "請輸入出生年份", 77)
Else
If a > 1 And a < 100 Then
i = a Mod 10
If i = 0 Then
i = 10
End If
o = Mid("壬癸甲乙丙丁戊己庚辛", i, 1)
j = a Mod 12
If j = 0 Then
j = 12
End If
p = Mid("子丑寅卯辰巳午未申酉戌亥", j, 1)
q = Mid("鼠牛虎兔龍蛇馬羊猴雞狗豬", j, 1)
Print o + p & "年," & "肖" & q
End If
End If
End Sub

2006-05-02 13:49:16 · answer #1 · answered by Anonymous · 0 0

Private Sub Command1_Click()Dim A() As String, B() As String, C() As String, S$, N%Do  S = InputBox("請輸入西元生日", , Date)  If S = "" Then Exit SubLoop Until IsDate(S)N = (Year(S) - 3) Mod 60A = Split("癸 甲 乙 丙 丁 戊 己 庚 辛 壬")B = Split("亥 子 丑 寅 卯 辰 巳 午 未 申 酉 戌")C = Split("豬 鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗")Print "西元"; Year(S); "年為"; A(N Mod 10); B(N Mod 12); "年,生肖屬"; C(N Mod 12)End Sub

2006-05-01 20:51:46 · answer #2 · answered by W.J.S. 7 · 0 0

這應該用java寫好像比較容易吧
一定要用vb寫嗎??

2006-05-01 17:14:19 · answer #3 · answered by my nickname 1 · 0 0

fedest.com, questions and answers