题目描述
近几年星座运势十分流行,据说一年之中根据月份可以分出十二个星座,它们分别是:摩羯座(12.21-1.19),水瓶座(1.20-2.18),双鱼座(2.19-3.20),白羊座(3.21-4.19),金牛座(4.20-5.20),双子座(5.21-6.21),巨蟹座(6.22-7.22),狮子座(7.23-8.22),处女座(8.23-9.22),天秤座(9.23-10.23),天蝎座(10.24-11.22),射手座(11.23-12.21),猴哥对星座很感兴趣,他想快速根据自己的出生日期求出他所属的星座,请你编程帮助他吧~
include
/*
#include <stdio.h>
void constellation(int year,int month,int day);
int main()
{
int year,month,day;
scanf("%d %d %d",&year,&month,&day);
constellation(year,month,day);
return 0;
}
*/
void constellation(int year,int month,int day)
{
if((month==3&&(day>=21&&day<=31))||(month==4&&(day>=1&&day<=19)))
printf("白羊座\n");
if((month==4&&(day>=20&&day<=30))||(month==5&&(day>=1&&day<=20)))
printf("金牛座\n");
if((month==5&&(day>=21&&day<=31))||(month==6&&(day>=1&&day<=21)))
printf("双子座\n");
if((month==6&&(day>=22&&day<=30))||(month==7&&(day>=1&&day<=22)))
printf("巨蟹座\n");
if((month==7&&(day>=23&&day<=31))||(month==8&&(day>=1&&day<=22)))
printf("狮子座\n");
if((month==8&&(day>=23&&day<=31))||(month==9&&(day>=1&&day<=22)))
printf("处女座\n");
if((month==9&&(day>=23&&day<=30))||(month==10&&(day>=1&&day<=23)))
printf("天秤座\n");
if((month==10&&(day>=24&&day<=31))||(month==11&&(day>=1&&day<=22)))
printf("天蝎座\n");
if((month==11&&(day>=23&&day<=31))||(month==12&&(day>=1&&day<=21)))
printf("射手座\n");
if((month==12&&(day>=22&&day<=31))||(month==1&&(day>=1&&day<=19)))
printf("摩羯座\n");
if((month==1&&(day>=20&&day<=31))||(month==2&&(day>=1&&day<=18)))
printf("水瓶座\n");
if((month==2&&(day>=19&&day<=29))||(month==3&&(day>=1&&day<=20)))
printf("双鱼座\n");
}