Click here to Skip to main content
15,902,634 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Where to find connect declaration of this mysql instace Pin
coco24310-Jan-23 6:03
coco24310-Jan-23 6:03 
GeneralRe: Where to find connect declaration of this mysql instace Pin
Richard MacCutchan10-Jan-23 6:42
mveRichard MacCutchan10-Jan-23 6:42 
GeneralRe: Where to find connect declaration of this mysql instace Pin
coco24310-Jan-23 8:12
coco24310-Jan-23 8:12 
GeneralRe: Where to find connect declaration of this mysql instace Pin
markkuk10-Jan-23 2:27
markkuk10-Jan-23 2:27 
GeneralRe: Where to find connect declaration of this mysql instace Pin
coco24310-Jan-23 4:11
coco24310-Jan-23 4:11 
AnswerRe: Where to find connect declaration of this mysql instace Pin
RedDk8-Jan-23 9:12
RedDk8-Jan-23 9:12 
Questiondll access violation with Excel 32 / 64 bits Pin
Danilo Lemos 20216-Jan-23 1:30
Danilo Lemos 20216-Jan-23 1:30 
AnswerRe: dll access violation with Excel 32 / 64 bits Pin
Victor Nijegorodov6-Jan-23 5:49
Victor Nijegorodov6-Jan-23 5:49 
QuestionLinker error when adding Ole to my application, what am I missing? Pin
charlieg4-Jan-23 16:15
charlieg4-Jan-23 16:15 
AnswerRe: Linker error when adding Ole to my application, what am I missing? Pin
CPallini4-Jan-23 22:14
mveCPallini4-Jan-23 22:14 
GeneralRe: Linker error when adding Ole to my application, what am I missing? Pin
charlieg6-Jan-23 5:07
charlieg6-Jan-23 5:07 
QuestionRe: Linker error when adding Ole to my application, what am I missing? Pin
Randor 5-Jan-23 16:41
professional Randor 5-Jan-23 16:41 
AnswerRe: Linker error when adding Ole to my application, what am I missing? Pin
charlieg6-Jan-23 10:17
charlieg6-Jan-23 10:17 
GeneralRe: Linker error when adding Ole to my application, what am I missing? Pin
Randor 6-Jan-23 10:40
professional Randor 6-Jan-23 10:40 
Questionhow to interact with access control and open the door from My c++ desktop application Pin
Zouaoui Billel31-Dec-22 4:58
Zouaoui Billel31-Dec-22 4:58 
AnswerRe: how to interact with access control and open the door from My c++ desktop application Pin
Richard MacCutchan31-Dec-22 5:11
mveRichard MacCutchan31-Dec-22 5:11 
QuestionMessage Closed Pin
27-Dec-22 9:31
Member 1496877127-Dec-22 9:31 
AnswerRe: How to link C code to which Bluetooth library ? ( Linux) Pin
k505427-Dec-22 10:30
mvek505427-Dec-22 10:30 
AnswerRe: How to link C code to which Bluetooth library ? ( Linux) Pin
Richard MacCutchan27-Dec-22 22:03
mveRichard MacCutchan27-Dec-22 22:03 
QuestionInsert a Container App Pin
Glenn Meadows 202227-Dec-22 5:07
Glenn Meadows 202227-Dec-22 5:07 
AnswerRe: Insert a Container App Pin
Richard MacCutchan27-Dec-22 22:06
mveRichard MacCutchan27-Dec-22 22:06 
SuggestionRe: Insert a Container App Pin
David Crow28-Dec-22 4:49
David Crow28-Dec-22 4:49 
QuestionHaving trouble with a function in C Pin
BuilderboiYT26-Dec-22 15:38
BuilderboiYT26-Dec-22 15:38 
AnswerRe: Having trouble with a function in C Pin
Victor Nijegorodov26-Dec-22 20:12
Victor Nijegorodov26-Dec-22 20:12 
AnswerRe: Having trouble with a function in C Pin
Richard MacCutchan26-Dec-22 22:10
mveRichard MacCutchan26-Dec-22 22:10 
Your code is somewhat confusing, but I did notice the following:
C++
int days_left_in_month; // *** this needs to be initialised to some value
while(days_left_in_month > 0)
{
days_left_in_month = days_in_month[*mm] - *dd;
// days_left_in_month = days_in_month[*mm] - *dd;
if (days_in_month[2] && is_leap_year(*yy) == true) // ***days_in_month[2] is always non-zero, you should be checking if month is greater than 2.
{
days_left_in_month++;
}
} // end while

The actual logic needed is as follows:
Set days_in_year to the actual number of days up to the date given, which in the case above should be 365.
Add days_to_add to days_in_year.
While days_in_year > 365
{
    add 1 to year
    subtract 365 from days_in_year
}
Use the remaining value of days_in_year to calculate the month and day.

Obviously an adjustment for leap years will be needed somewhere in there.

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.