Chinese zodiac: Difference between revisions
Content added Content deleted
(insert →Pascal) |
No edit summary |
||
Line 4,334: | Line 4,334: | ||
1985 is the year of the Wood Ox (yin). 乙丑 |
1985 is the year of the Wood Ox (yin). 乙丑 |
||
2017 is the year of the Fire Rooster (yin). 丁酉</pre> |
2017 is the year of the Fire Rooster (yin). 丁酉</pre> |
||
=={{header|Vlang}}== |
|||
{{trans|Go}} |
|||
<lang vlang>const ( |
|||
animal_string = ["Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", |
|||
"Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"] |
|||
stem_yy_string = ["Yang", "Yin"] |
|||
element_string = ["Wood", "Fire", "Earth", "Metal", "Water"] |
|||
stem_ch = "甲乙丙丁戊己庚辛壬癸".split('') |
|||
branch_ch = "子丑寅卯辰巳午未申酉戌亥".split('') |
|||
) |
|||
fn cz(y int) (string, string, string, string, int) { |
|||
yr := y-4 |
|||
stem := yr % 10 |
|||
branch := yr % 12 |
|||
return animal_string[branch], |
|||
stem_yy_string[stem%2], |
|||
element_string[stem/2], |
|||
[stem_ch[stem], branch_ch[branch]].join(''), |
|||
yr%60 + 1 |
|||
} |
|||
fn main() { |
|||
for yr in [1935, 1938, 1968, 1972, 1976] { |
|||
a, yy, e, sb, cy := cz(yr) |
|||
println("$yr: $e $a, $yy, Cycle year $cy $sb") |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
<pre> |
|||
Same as Go entry |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |