Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
2
Indexable
Never
if ((month == 1) || (month == 3) || (month == 5) || (month == 10) || (month == 12))
    {
        if (day > 31)
        {
            day = day - 31;
            month++;
            if (month == 13)
                month = 1;
            year++;
        }
    }
    if (day < 1)
    {
        month--;
        if (month == 0)
        {
            day = day + 31;
            month = 12;
            year--;
        }
        else if (month == 2)
        {
            if (leapyear == 1)
            {
                if (day > 29)
                {
                    day = day - 29;
                    month;
                }

                else
                {
                    if (day > 28)
                    {
                        day = day - 28;
                        month++;
                    }
                    else {
                        day = day + 31;
                    }
                }
            }
        }
    }
    cout << "\n The final date is: " << day << "/" << month << "/" << year << endl;