恨恨 我超討厭這題目
怒哪!! 真XX- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main(void){
-
- int year,month,day;
- while(cin>>year>>month>>day){
- if(month==1&&day==1){
- cout << "It is 1 day in " <<year<< endl;
- continue;
- }
-
-
- int check ;
- for(int a=1;a<=12;a++)
- check = ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0) ? 1 : 0 ;
- int date = day ;
-
- switch ( month ) {
- case 12: date += 30;
- case 11: date += 31;
- case 10: date += 29;
- case 9: date += 31;
- case 8: date += 31;
- case 7: date += 30;
- case 6: date += 31;
- case 5: date += 30;
- case 4: date += 31;
- case 3: date += 29;
- case 2: date += 31;
- }
-
- if( check == 1 && month >= 3 ) ++date ;
- if(date<32){
- cout<<"Error"<<endl;
- break;
- }else{
- cout << "It is " << date << " days " << "in " <<year<< endl;
- }
- }
- system("pause");
- return 0;
- }
複製代碼 |