A nice, simple question
I have been keeping a log file for how many seconds I have been testing out my latest program, using the clock() function. Now, I want to convert this into days, hours, minutes, and seconds. I know modulus division is involved somewhere, but I never did pay attention to that ;) ...
int a = 7;
int b = 3;
cout << a%b << endl;
"%" is the modulus "/"
COOL PROGRAMS @ www.akilla.tk
I know how to do modulus division, it just leaves a remainder, but I was wondering how I convert seconds into various other time increments? Do I first put the seconds into days, then do modulus division by 24 to get hours????????????????????? Kill me now ;)
An hour has 3600 secs so if you divide the number of secs you have with 3600 you'll get the hour
the ouptut should be : 10 HOURS, 4 MINUTES and 10 SECONDS
int totsec=36250; //assuming this value
int hrs,min,rem; //rem=remainder time
cout<<"30,000 seconds = "<<hrs<<" HOURS, "<<min<<" MINUTES and "<<rem<<" SECONDS";
i hope this is what you are asking.. :D
Ah, ihsir, thank you for the help, that is exactly what I am asking :)