Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
995 B
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++;
                    }
                }
            }
        }
    }
    cout << "\n The final date is: " << day << "/" << month << "/" << year << endl;