We'd love to help you, but you must first read this . Then post your latest attempt, encased within code tags (and tell us what's not working so we don't have to guess).
Thanks
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
I dunno, maybe actually try it for yourself rather than wandering from board to board in the hope that someone will spoon-feed you the answer.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
>I'm not looking to be spoon fed an answers
Then show that you're willing to try. Post your latest coding attempt at it.
>i'm looking for help!!!
We'll help you once you post what you've already tried.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
>OK , but how do i paste my code into this message box?First of all type your message text
Type [code]
Insert some spaces, then type [/code]
Paste your code in between the space that you made between the code tags
I'm assuming of course, that you know how to use your clipboard to copy items. ;)
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
#include <iostream>
#include <math.h>
#include <stdlib.h>
Alright - so which language are you trying to write in: C or C++? stdlib.h is a C header, and if you really need to use C functions (which I can't seem to find any in your code below) then you can use include <cstdlib> instead.
Since when are there 13 months in a year? And why are you keeping track of the number of days in each year; all you need is a second array for leap year.
Then you can calculate which years are leap years by using a starting year that you know is a leap year (drat, I can't remember when was our last leap year) and then comparing it to the year entered by the user. Hint: you'll need the % (modulos) operator.
The rest should be fairly easy; all you need to do is subtract years and multiply it by the number of days in the year you found earlier, multiply the difference of months by looking up the month array, and then adding the remainig days (if that made any sense at all).
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
if (month < 0 || month > 12 || day < 0 || day >31 || year > 1900 ||| year < 2099 )
I believe you have 3 mistakes here in this line
SHWOO
Junior Poster in Training
73 posts since Jul 2006
Reputation Points: 41
Solved Threads: 0
if (month < 0 || month > 12 || day < 0 || day > 31 || year < 1900 ||| year >2099 )
fixed! :cheesy:
Somehow I doubt it... Look at the last ||
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944