让小的日期自增直到和大的相同记录中间自增的天数即可。

#include<iostream>
using namespace std;

bool ismax(int year1,int month1,int day1,int year2,int month2,int day2)
{
    if(year1>year2)
        return true;
    else if(year1==year2)
    {
        if(month1>month2)
            return true;
        else if(month1==month2)
        {
            if(day1>day2)
                return true;
        }
    }
    return false;
}
void Swap(int&x,int&y)
{
    int tmp = x;
    x = y;
    y = tmp;
}
int Getmonthday(int year,int month)
{
    static int mday[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
    int day = mday[month];
    if(month==2 && (year%4==0&&year%100!=0||year%400==0))
        day++;
    return day;
}
int main()
{
    int year1,month1,day1;
    int year2,month2,day2;
    scanf("%4d%2d%2d",&year1,&month1,&day1);
    scanf("%4d%2d%2d",&year2,&month2,&day2);
    int count = 1;
    //找出较大的那个日期
    if(!ismax(year1,month1,day1,year2,month2,day2))
    {
        Swap(year1,year2);
        Swap(month1,month2);
        Swap(day1,day2);
    }
    //让小的日期自增直到相等。
    while(year1!=year2 || month1!=month2 || day1!=day2)
    {
        ++count;
        ++day2;
        if(day2>Getmonthday(year2,month2))//获取每个月的天数
        {
            day2 = 1;
            month2++;
            if(month2>12)
            {
                month2=1;
                year2++;
            }
        }
    }
    cout<<count<<endl;
    return 0;
}