Error Checking If Statements on months and days

Pages: 12
ok so
i can make it like this
1 year = 31536000 seconds
1 day = 86400 soconds
1 hour = 3600 seconds
1 min = 60 seconds

monthDiff = month - 1 ;
yearDiff = year - 2000
dayDiff = day - 1

and than
hourDiff = hour - 1;
minDiff = min - 1


and than (yearDiff*31536000 seconds)+(dayDiff*86400 soconds) + (hourDiff*3600 seconds)+ (minDiff*60 seconds) + seconds


now im stuck on the month part couse yeah a month dont have specific seconds so please how can i do this????
hey sorry this is not tha code is just the idea.....
Helios, I was searching the internet actually and I thought the numbers were a bit weird... thanks for the reply, if you wouldnt mind can i send you my code for you to look at? I want to tweek it if I can? It works but I want it to be elegant, im not sure if it. lol.

Mags, im not gonna show you code for obvious reasons but if you know C++ then once you have the logical process coding should be easy enough.

Go through each day individually, adding as you go.

You should already know how to work out leap years, if not, look back to the programming guide on WebCT, its given in one of the exercises in the early chapters.

thats all that I have used really.
people ask me questions in class everyday lolz, ill tell you, what I tell them. THINK ABOUT IT!

if the month is jan,mar,may,jul,aug,oct,dec, then

the days in the month will be 31

ect...

lolz now im giving it away!
Last edited on
NannyCool: Yeah, sure, send it. I haven't had a good laugh in a while.
I won't touch it but I will point out what you're doing wrong.
first where have you accounted for leap years...its something to think about, obviously if its a leap year it will have an extra day in it.

with the months, you have to determine what month it is and how many days are in that month, you can use a similar process as in the post above.

calculating the days, hours and minutes should be simple enough to deal with.

write some code, post it up and ill have a look at it.
ok really thanks:D i will post the code soon
hey Helios, just e-mailed you the code, the code is still a work in progress, but i hope its clear enough. Looking forward to your reply.
If you're stuck just ask Simon for help.

Oh no, secrets out!
has SPlat changed his policy on helping people with assignments? I asked him a while back and he said he couldnt help with the assignments??
No its still the same but its just that our magmatic friend here has been asking for what can only appear to be the ENTIRE of his code to be handed to him on a silver platter.

Got mine finished today and thought I would browse round the forums only to find that people are asking for their assignments to be handed to them by others.

Its ok, I'm sure it will only rub off badly somehow.
Hmm... Renzokuken, NannyCool, and Magmatic... are all three of you taking the same course, working on the same project?
Would seem so.

No idea on whom the other 2 are in person.

Either way finished mine today and its quite short and works right so I'm content with that.

All I'll say mag is look into arrays and it will save you a lot of lines of code.
LoL Renzokuken. You play Final Fantasy too much :-)

I <3 Final Fantasy :D
Last edited on
lol, gord you get your program finished in the end...?
Heya guys, I've finished my code and im ready to submit! I really want to have a look at how others have dealt with the problem. So anyone want to share their solutions after the due date has passed?
hey can i send to someone my code to check it?????/
sure mags, but i dont know how helpful I can be... my addy is ninza_123@hotmail.com
Topic archived. No new replies allowed.
Pages: 12