输入年月日,求这一天是这一年中的第多少天解决思路

输入年月日,求这一天是这一年中的第多少天
我写了个程序,不知哪里错了,好心人帮忙指出来啊
#include<iostream>
using namespace std;
struct 
{
  int year;  
  int month; 
  int day; }date;  
int main()
{
int i,days;
cout<<"input year:";
cin>>date.year;
  cout<<"input month:"; 
  cin>>date.month; 
cout<<"input day:";
  cin>>date.day; 
days=0;

for(i=1;i<date.month;i++){

switch(i){
  case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:days+=31;
break;
case 4:
case 6:
case 9:
case 11:days+=30;
break;

case2:if((date.year%4==0)&&(date.year%100!=0)||(date.year%400==0))
days=days+29;
else
days=days+28;
break;
}
}
cout<<"the day in "<<days+date.day<<"."<<endl;
return 0;
}



------解决方案--------------------
探讨

那怎么改?