RosettaCodeData/Task/Chinese-zodiac/FreeBASIC/chinese-zodiac.basic
2023-07-01 13:44:08 -04:00

18 lines
625 B
Text

dim as string yy(0 to 1) = {"yang", "yin"}
dim as string elements(0 to 4) = {"Wood", "Fire", "Earth", "Metal", "Water"}
dim as string animals(0 to 11) = {"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake",_
"Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"}
dim as uinteger yr, y, e, a, i, tests(0 to 5) = {1801, 1861, 1984, 2020, 2186, 76543}
dim as string outstr
for i = 0 to 5
yr = tests(i)
y = yr mod 2
e = (yr - 4) mod 5
a = (yr - 4) mod 12
outstr = str(yr)+" is the year of the "
outstr += elements(e)+" " + animals(a) + " (" + yy(y) + ")."
print outstr
next i