# A nice, simple question

This is a discussion on A nice, simple question within the C++ Programming forums, part of the General Programming Boards category; I have been keeping a log file for how many seconds I have been testing out my latest program, using ...

1. ## 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 ...

2. ## Here's how

Code:
```int a = 7;
int b = 3;

cout << a%b << endl;
(or)
printf("%d", a%b);```
OUTPUT:
1

"%" is the modulus "/"

COOL PROGRAMS @ www.akilla.tk

3. Yes...well...
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

4. An hour has 3600 secs so if you divide the number of secs you have with 3600 you'll get the hour

Code:
```int totsec=36250; //assuming this value
int hrs,min,rem; //rem=remainder time

hrs=totsec/3600;
rem=totsec%3600;

min=rem/60;
rem=rem%60;

cout<<"30,000 seconds = "<<hrs<<" HOURS, "<<min<<" MINUTES and "<<rem<<" SECONDS";```
the ouptut should be : 10 HOURS, 4 MINUTES and 10 SECONDS

i hope this is what you are asking..

5. Ah, ihsir, thank you for the help, that is exactly what I am asking