Can someone tell me why intLeapInd and intDayOfYear isn't getting set? (I'll only post bits of code)
<code>
class DateObj
{
//private
int intMonth,
intDay,
intYear,
intLeapInd,
intDayOfYear;
friend void LeapYear(DateObj ob);
friend void DayOfYear(DateObj ob);
public:
DateObj(int m, int d, int y);
void Display();
};
DateObj:
ateObj(int m, int d, int y)
{
intMonth = m;
intDay = d;
intYear = y;
LeapYear(*this);
DayOfYear(*this);
}
void LeapYear(DateObj ob)
{
//do calc to see if leap year
if ((ob.intYear % 4 == 0) && (ob.intYear % 100 != 0 || ob.intYear % 400 == 0))
ob.intLeapInd = 1; //this is a leap year
else
ob.intLeapInd = 0; //this is not a leap year
}
</code>
Thanks!
<code>
class DateObj
{
//private
int intMonth,
intDay,
intYear,
intLeapInd,
intDayOfYear;
friend void LeapYear(DateObj ob);
friend void DayOfYear(DateObj ob);
public:
DateObj(int m, int d, int y);
void Display();
};
DateObj:
{
intMonth = m;
intDay = d;
intYear = y;
LeapYear(*this);
DayOfYear(*this);
}
void LeapYear(DateObj ob)
{
//do calc to see if leap year
if ((ob.intYear % 4 == 0) && (ob.intYear % 100 != 0 || ob.intYear % 400 == 0))
ob.intLeapInd = 1; //this is a leap year
else
ob.intLeapInd = 0; //this is not a leap year
}
</code>
Thanks!