请问这个程序哪里有问题吗?

#include
using namespace std;
int main()
{
int year,mon;
int i,j,count = 0;
int t = 1,k=1;
int array[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int curYear,curMon,curDay, wk;
curYear = 2021;
curMon = 10;
curDay = 27;
week = 3;
scanf("%d %d",&year,&mon);
if(curYear > year)
{
for(i=mon;i<=12;i++)
{
if(i==2)
{
if(year%4==0 && year%100 !=0 || year%400==0)
count += 29;
else
count += 28;
}else
count += array[i];
}
for(i=year+1;i<curYear;i++)
{
if(i%4==0 && i%100 !=0 || i%400==0)
count += 366;
else
count += 365;
}
for(i=1;i<curMon;i++)
{
if(i==2)
{
if(curYear%4==0 && curYear%100 !=0 || curYear%400==0)
count += 29;
else
count += 28;
}else
count += array[i];
}
count += curDay;
week = 7 - (week+count)%7;
}else if(curYear == year)
{
if (mon > curMon)
{
for(i=curMon+1;i<mon;i++)
{
if (i==2)
{
if(curYear%4==0 && curYear%100 !=0 || curYear%400==0)
count += 29;
else
count += 28;
}else
count += array[i];
}
count += array[curMon] - curDay;
week = (week + count%7)%7+1;
}else if(mon == curMon)
{
week = (week +7- (curDay-1)%7)%7;
}else
{
for (i=mon;i<curMon;i++)
{
if(i==2)
{
if(curYear%4==0 && curYear%100 !=0 || curYear%400==0)
count += 29;
else
count += 28;
}else
count += array[i];
}
count += curDay;
week = (week+7-(count-1)%7)%7;
}
}else
{
for(i=curMon+1;i<=12;i++)
{
if(i==2)
{
if(curYear%4==0 && curYear%100 !=0 || curYear%400==0)
count += 29;
else
count += 28;
}else
count += array[i];
}
for(i=curYear+1;i<year;i++)
{
if(i%4==0 && i%100 !=0 || i%400==0)
count += 366;
else
count += 365;
}
for(i=1;i<mon;i++)
{
if(i==2)
{
if(year%4==0 && year%100 !=0 || year%400==0)
count += 29;
else
count += 28;
}else
count += array[i];
}
count += curDay;
week = (week+count-1)%7;
}
printf("一 二 三 四 五 六 日\n");
//int t = 1,k=1;
if(year%4==0 && year%100 !=0 || year%400==0) array[2]= 29;
while(t <= array[mon])
{
if(k<week)
{
printf(" ");
}else
{
printf("%-3d",t);
t++;
}
if(k%7==0) printf("\n");
k++;
}
return 0;
}

1.week=3,没有定义week,只要wk