目录根据生日计算星座根据生日计算属相根据生日计算星座 func GetZodiac(month, day int) string { month = month - 1
func GetZodiac(month, day int) string {
month = month - 1
var (
DAY_ARR = [12]int{20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22}
ZODIACS = [13]string{"摩羯座", "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座"}
)
if day < DAY_ARR[month] {
return ZODIACS[month]
} else {
return ZODIACS[month+1]
}
}
func GetChineseZodiac(year int) string {
var CHINESE_ZODIACS = [12]string{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}
if year > 1900 {
return CHINESE_ZODIACS[(year-1900)%len(CHINESE_ZODIACS)]
} else {
return ""
}
}
源码地址
以上就是Golang根据生日计算星座和属相实例的详细内容,更多关于golang计算星座属相的资料请关注编程网其它相关文章!
--结束END--
本文标题: golang根据生日计算星座和属相实例
本文链接: https://lsjlt.com/news/164231.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-04-05
2024-04-05
2024-04-05
2024-04-04
2024-04-05
2024-04-05
2024-04-05
2024-04-05
2024-04-04
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0