- #include <iostream>
- using namespace std;
- struct Date
- {
- int year;
- int month;
- int day;
- };
- int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
- int main()
- {
- Date date;
- cout<<"input year,month,day:";
- cin>>date.year>>date.month>>date.day;
- int days=0,i;
- for(i=1;i<date.month;++i)
- days+=d[i];
- days+=date.day;
- if ((date.year %4== 0 && date.year % 100 != 0
- ||date.year % 400 == 0) && date.month >=3)
- days+=1;
- cout<<date.month<<"月"<<date.day<<"日是"<<date.year<<"年的第"<<days
- <<"天."<<endl;
- return 0; }
posted @
2013-03-07 22:16
_一千零一夜
阅读(
98)
评论()
编辑
收藏
举报