Click here to Skip to main content
15,914,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalbatch file for setting env variables Pin
John Oliver17-Jun-04 0:05
John Oliver17-Jun-04 0:05 
GeneralRe: batch file for setting env variables Pin
David Crow17-Jun-04 3:15
David Crow17-Jun-04 3:15 
GeneralRe: batch file for setting env variables Pin
John Oliver17-Jun-04 3:39
John Oliver17-Jun-04 3:39 
QuestionAny idea on this simple application? Pin
Nelson L.16-Jun-04 22:25
Nelson L.16-Jun-04 22:25 
AnswerRe: Any idea on this simple application? Pin
John Oliver17-Jun-04 0:08
John Oliver17-Jun-04 0:08 
GeneralON_COMMAND_RANGE problem Pin
ThatsAlok16-Jun-04 22:20
ThatsAlok16-Jun-04 22:20 
GeneralRe: ON_COMMAND_RANGE problem Pin
Cedric Moonen16-Jun-04 23:24
Cedric Moonen16-Jun-04 23:24 
Generaloperator- in Date Class Pin
foxele16-Jun-04 21:35
foxele16-Jun-04 21:35 
Hello:

I am writting a Date Class, and I want to overload operator - that can take a Date object, I wrote the code, but I felt it is stupid, Please help me:

***************************************************************************
int Date::days[] = {0, 31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};


int Isbigger(int year, int right_year)
{
int bigger;

bigger = year > right_year?year:right_year;

returen bigger;
}//get the bigger value of two

int Issmaller(int year, int right_year)
{
int smaller;

smaller = year < right_year? year:right_year;

return smaller;

}//get the smaller value of two




int Date::operator -(Date right)
{


int subday;
int subyear;

if (year == right.year)
{
subyear = 0;
if(month == right.month)
{
subday = Isbigger(day, right.day) - Issmaller(day,right.day); //if the same year and same month, just subtract the date;
}

else if(month != right.month) //if same year different month,
{

subday = (days[month] - day) + right.day); //get the days in beginning and ending month,

for(i = (Isbigger(day,right.day) - 1); i >issmaller(day,right.day) ; i++)
{
subday += days[i]; //then plus the intermedia month,
}
}

}

else //not in the same year
{
int yearDifference;
yearDifference = Isbigger(year,right.year) - 1;

subyear = yearDifference * 365;

if(month == right.month)
{
subday = Isbigger(day, right.day) - Issmaller(day,right.day); //if the same year and same month, just subtract the date;
}

else if(month != right.month) //if same year different month,
{

subday = (days[month] - day) + right.day); //get the days in beginning and ending month,

for(i = (Isbigger(day,right.day) - 1); i >issmaller(day,right.day) ; i++)
{
subday += days[i]; //then plus the intermedia month,
}
}

subday += subyear;

}

return subday;

}


Thank You So Much
GeneralRe: operator- in Date Class Pin
V.16-Jun-04 22:00
professionalV.16-Jun-04 22:00 
GeneralRe: operator- in Date Class Pin
John Oliver17-Jun-04 2:12
John Oliver17-Jun-04 2:12 
GeneralRe: operator- in Date Class Pin
John Oliver17-Jun-04 0:20
John Oliver17-Jun-04 0:20 
GeneralActiveX Registration Pin
marcomars16-Jun-04 21:31
marcomars16-Jun-04 21:31 
QuestionDoes ALU inside the cpu handle floating point? or cpu will let the FPU handle it? Pin
Link260016-Jun-04 21:16
Link260016-Jun-04 21:16 
AnswerRe: Does ALU inside the cpu handle floating point? or cpu will let the FPU handle it? Pin
Link260017-Jun-04 14:44
Link260017-Jun-04 14:44 
GeneralRun Windows Installer in background Pin
Peter Nirschl16-Jun-04 20:44
Peter Nirschl16-Jun-04 20:44 
GeneralRe: Run Windows Installer in background Pin
Blake Miller17-Jun-04 4:14
Blake Miller17-Jun-04 4:14 
GeneralRe: Run Windows Installer in background Pin
Peter Nirschl17-Jun-04 4:41
Peter Nirschl17-Jun-04 4:41 
GeneralRe: Run Windows Installer in background Pin
Blake Miller17-Jun-04 4:45
Blake Miller17-Jun-04 4:45 
QuestionHow to use msadox.dll and msado15.dll together in same file Pin
Kaustubh_deo16-Jun-04 20:05
Kaustubh_deo16-Jun-04 20:05 
AnswerRe: How to use msadox.dll and msado15.dll together in same file Pin
RChin16-Jun-04 22:59
RChin16-Jun-04 22:59 
QuestionHow to remove a class ? Pin
Rajesh_K_Sharma16-Jun-04 19:43
Rajesh_K_Sharma16-Jun-04 19:43 
AnswerRe: How to remove a class ? Pin
Michael Dunn16-Jun-04 20:01
sitebuilderMichael Dunn16-Jun-04 20:01 
GeneralRe: How to remove a class ? Pin
RChin16-Jun-04 23:03
RChin16-Jun-04 23:03 
Generalstatic linking Pin
ask_you16-Jun-04 19:38
ask_you16-Jun-04 19:38 
GeneralRe: static linking Pin
Frank K17-Jun-04 0:39
Frank K17-Jun-04 0:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.