Quote:Original post by GroZZleRQuote:Original post by CJH
{seconds an int}
int hours = seconds / 3600;
int minutes = (seconds % 3600) / 60;
int seconds = seconds % (60);
This would work too, but you never actually modify the seconds variable, which means your calculation of int seconds = (seconds) will be off. No?
I don't quite understand. He is modifying the seconds variable. On the last line. seconds = seconds % (60); That would effectively chop it off anywhere from 0 to 59.
Edit: Perhaps you mean that he is redeclaring the seconds variable which was used to hold the initial number of seconds. That could easily be fixed by changing variable names or dropping the int before the seconds on the last line.