I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » C/C++ »

will\′s Photo
20 Sep 06, 6:45AM
ok, your single 4 digit number actually has the correct number of minutes already stated (30 in you example), however the hours need multiplying by 60.

When you divide by 100, you end up with a number, say 12.3, which is has the wrong fraction, i.e. its really should be 12.5, i.e. 12 and half hours. Therefore we need to correct this. You therefore want to calculate:

or:

double t = time/100.0;  
int minutes = (t-int(t))*100 + int(t)*60
return
Currently you need to be logged in to leave a message.