新微赢技术网

标题: 请问这个程序除了什么问题,没有输出 [打印本页]

作者: 小华﹖    时间: 2009-11-3 01:42
标题: 请问这个程序除了什么问题,没有输出
#include <iostream>
#include <string>
using namespace std;
int main()
{
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int n;
int t,i,newyear;
string week[7]={"Monday","Tuesday","Wednesday","Thurday","Friday","Saturday","Sunday"};
while((cin>>n)&&n!=-1)
{ int year=2000;
while(n>365)
{ if(year%4==0 || (year%100!=0 && year%400==0))
t=n-366;
else
t=n-365;
year++;
}
newyear=2000+n/365;
cout<<newyear;
if(year%4==0 || (year%100!=0 && year%400!=0))
a[1]=29;
i=0;
while(t>30)
{
t=t-a[i];
i=i+1;
}

if((n%7)+6>7)
{
week[(n%7)+6]=week[(n%7)+6-7];
}
cout<<year<< "-" <<i<<t<<week[(n%7)+6-1]<<endl;

}
}




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2