Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.0 kB
2
Indexable
Never
// ID: 20001945 Name: Thomas Geris
#include <iostream>
using namespace std;
int difference, day, month, year, leapyear;

int main()

{
    cout << "\n Enter the difference in days and press Enter : ";
    cin >> difference;

    cout << "\n Enter a date in the form of DD MM YYYY and press enter: ";
    cin >> day >> month >> year;

    day = day;
    day = day + difference;

    if (month == 2)
    {
        if (leapyear == 1)
        {
            if (day > 29)
            {
                day = day - 30;
                month = month ++;
            }
            else
            {
                cout << year << " is a leap year\n";
                {
                    cout << year << " is NOT a leap year\n";
                }

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