Last active
October 28, 2017 13:52
-
-
Save hansen033/81dfeca4d4580208d8fd33a4db7352a7 to your computer and use it in GitHub Desktop.
2017.10.20 前一天的修正版題目
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int month, b; | |
cout << "輸入出生日期來得知此日期出生的人的星座\n"; | |
cout << "\n請輸入出生月份:"; | |
cin >> month; | |
cout << "請輸入出生日期:"; | |
cin >> b; | |
if (month%1!=0){ | |
cout << "月份哪有小數的啦!!"; | |
} else if (b%1!=0){ | |
cout << "日期哪有小數的啦!!"; | |
} else if ((month==1 && b>=21 && b<=31)||(month==2 && b>=1 && b<=19)){ | |
cout << "在" << month << "/" << b << "出生的人是水瓶座"; | |
} else if ((month==2 && b>=20 && b<=29)||(month==3 && b>=1 && b<=20)){ | |
cout << "在" << month << "/" << b << "出生的人是雙魚座"; | |
} else if ((month==3 && b>=21 && b<=31)||(month==4 && b>=1 && b<=20)){ | |
cout << "在" << month << "/" << b << "出生的人是牡羊座"; | |
} else if ((month==4 && b>=21 && b<=30)||(month==5 && b>=1 && b<=21)){ | |
cout << "在" << month << "/" << b << "出生的人是金牛座"; | |
} else if ((month==5 && b>=22 && b<=31)||(month==6 && b>=1 && b<=21)){ | |
cout << "在" << month << "/" << b << "出生的人是雙子座"; | |
} else if ((month==6 && b>=22 && b<=31)||(month==7 && b>=1 && b<=23)){ | |
cout << "在" << month << "/" << b << "出生的人是巨蟹座"; | |
} else if ((month==7 && b>=24 && b<=31)||(month==8 && b>=1 && b<=23)){ | |
cout << "在" << month << "/" << b << "出生的人是獅子座"; | |
} else if ((month==8 && b>=24 && b<=31)||(month==9 && b>=1 && b<=23)){ | |
cout << "在" << month << "/" << b << "出生的人是處女座"; | |
} else if ((month==9 && b>=24 && b<=30)||(month==10 && b>=1 && b<=23)){ | |
cout << "在" << month << "/" << b << "出生的人是天平座"; | |
} else if ((month==10 && b>=24 && b<=31)||(month==11 && b>=1 && b<=22)){ | |
cout << "在" << month << "/" << b << "出生的人是天蠍座"; | |
} else if ((month==11 && b>=23 && b<=30)||(month==12 && b>=1 && b<=22)){ | |
cout << "在" << month << "/" << b << "出生的人是射手座"; | |
} else if ((month==12 && b>=23 && b<=31)||(month==1 && b>=1 && b<=20)){ | |
cout << "在" << month << "/" << b << "出生的人是摩羯座"; | |
} else { | |
cout << "\n恩...不太對吧?"; | |
} | |
cout <<"\n\n感謝您的使用,再見!"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment