assuming everything else works...i'm having trouble with the output...the if else statements are driving me crazy. it is outputting the date twice when i enter 7/3/12
code displays todays date....displays "payday" entered......adds 7 days to "payday" to show NEXT payday.

void Date::addDays(int month, int day, int year)
{
    _day = _day + 7;

    if(_day > 30)
    {
        _day = _day - 30;
        _month = _month + 1;
    }
    else 
    {
        cout << _month;
        cout << "/";
        cout << _day;
        cout << "/";
        cout << _year;

    }

     if(_month>12)
    {
        _month = _month - 12;
        cout << _month;
        cout << "/";
        cout << _day;
        _year = _year + 1;
        cout << "/";
        cout << _year;
    }
    else
    {
        cout << _month;
        cout << "/";
        cout << _day;
        cout << "/";
        cout << _year;
     }

}

**

OUTPUT:

When is pay day?
MONTH:  7
DAY:    3
YEAR:   12

Today's date is:   11/1/12

The date of payday is:   7/3/12

Next's week's payday is:   7/10/127/10/12

Press any key to continue . . .

**
**
OUTPUT:

When is pay day?
MONTH:  12
DAY:    29
YEAR:   12

Today's date is:   11/1/12

The date of payday is:   12/29/12

Next's week's payday is:   1/6/13

Press any key to continue . . .

OUTPUT:**

**

When is pay day?
MONTH:  11
DAY:    29
YEAR:   12

Today's date is:   11/1/12

The date of payday is:   11/29/12

Next's week's payday is:   12/6/12

Press any key to continue . . .

**

Look at your if statements - at least one of them has to execute in order to not print twice. So if there is a double printout, then neither if executed, thus both elses did.

Frankly, I think something else is going on somewhere else in the code which isn't shown here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.