Computer Science Canada Help with Time Calculator |
Author: | Misha [ Fri Oct 01, 2004 12:31 pm ] | ||
Post subject: | Help with Time Calculator | ||
Hi, I am real noob and I know this is an easy question but I just can't figure this out. My teacher told us to make a program that will take a number of seconds and convert them into days, hours, minutes, and the remaining seconds so for example 50000 seconds becomes o days, 13 hours, 53 minutes, and 20 seconds (thats the example my teacher gave). so Far I have this code but I can't figure out how to make it so that it does not convert each thing seperatly e.g. 50000 equalling 0 days, 13 hours, 833 minutes, and 50000 seconds. Here is my code so far:
any help would be greatly appreciated. Thanx |
Author: | josh [ Fri Oct 01, 2004 12:35 pm ] | ||
Post subject: | |||
What you need to do is convert all the dyas, hours, adn minutes back into seconds and subtract if from the total. Here is an example.
then output the results. ![]() good luck |
Author: | Paul [ Fri Oct 01, 2004 8:16 pm ] | ||
Post subject: | |||
the div and mod commands would help u here
that should work, if it doesn't then I am out of practice |
Author: | josh [ Fri Oct 01, 2004 9:27 pm ] |
Post subject: | |
Im tired the div and mod commands to but while I was doing itm I thjought if the other way and when I tried it I had less eroros (errors with the Div and Mod were probobly my fault) becuas you aren doing essentially the same thing. I think I ran into problems with the remainder from dyas cconvertin properly into the hours. |
Author: | gigaman [ Thu Oct 07, 2004 8:13 am ] |
Post subject: | I'm in this class too |
as far as the div and mod commands go it is all about the order you put them in in this program. if you put them in the wrong order your program doesn't work. |
Author: | josh [ Thu Oct 07, 2004 8:15 am ] |
Post subject: | |
exactly, which is why I found it easier to just convert everything back into seconds, but that is to complex for most of our class eh??? |