Chinese zodiac: Difference between revisions
Content added Content deleted
(→{{header|UNIX Shell}}: Make bash version work in ksh93+, too) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 24: | Line 24: | ||
Therefore 1984 was '''甲子''' (''jiă-zĭ'', or jia3-zi3). 2017 is the 34th year of the current cycle, '''丁酉''' (''dīng-yŏu'' or ding1-you3). |
Therefore 1984 was '''甲子''' (''jiă-zĭ'', or jia3-zi3). 2017 is the 34th year of the current cycle, '''丁酉''' (''dīng-yŏu'' or ding1-you3). |
||
=={{header|11l}}== |
|||
{{trans|C++}} |
|||
<lang 11l>V animals = [‘Rat’, ‘Ox’, ‘Tiger’, ‘Rabbit’, ‘Dragon’, ‘Snake’, ‘Horse’, ‘Goat’, ‘Monkey’, ‘Rooster’, ‘Dog’, ‘Pig’] |
|||
V elements = [‘Wood’, ‘Fire’, ‘Earth’, ‘Metal’, ‘Water’] |
|||
F getElement(year) |
|||
R :elements[(year - 4) % 10 I/ 2] |
|||
F getAnimal(year) |
|||
R :animals[(year - 4) % 12] |
|||
F getYY(year) |
|||
I year % 2 == 0 |
|||
R ‘yang’ |
|||
E |
|||
R ‘yin’ |
|||
L(year) [1935, 1938, 1968, 1972, 1976, 2017] |
|||
print(year‘ is the year of the ’getElement(year)‘ ’getAnimal(year)‘ (’getYY(year)‘).’)</lang> |
|||
{{out}} |
|||
<pre> |
|||
1935 is the year of the Wood Pig (yin). |
|||
1938 is the year of the Earth Tiger (yang). |
|||
1968 is the year of the Earth Monkey (yang). |
|||
1972 is the year of the Water Rat (yang). |
|||
1976 is the year of the Fire Dragon (yang). |
|||
2017 is the year of the Fire Rooster (yin). |
|||
</pre> |
|||
=={{header|360 Assembly}}== |
=={{header|360 Assembly}}== |