These functions are supposed to be used to get the seconds, minutes, hours, etc from a number of milliseconds. They are also supposed to return the number that would be displayed on a normal clock. For example, if I was wanting to get how many seconds 6500 milliseconds was, it wouldn't return 65 seconds, instead it would return 5 seconds. Does that make sense? Anyways, something seems to be wrong with my functions so can anyone go through them and find out what's wrong? I will award with a point to the first to solve the problem
- Code: Select all
int GetMill(int MILL)
{
int output = MILL;
int i;
for(i = 0; i <= MILL; i += 10)
{
if(i >= 1000) output -= 1000;
}
return output;
}
int GetSec(int MILL)
{
int output = 0;
int i;
int j = 0;
for(i = 0; i <= MILL; i += 10)
{
if(i >= 1000) j++;
}
output = j;
for(j; j > 60; j -= 60)
{
output -= 60;
}
return output;
}
int GetMin(int MILL)
{
int output = 0;
int i;
int j = 0;
for(i = 0; i <= MILL; i += 10)
{
if(i >= 60000) j++;
}
output = j;
for(j; j > 24; j -= 24)
{
output -= 24;
}
return output;
}
int GetHour(int MILL)
{
int output = 0;
int i;
for(i = 0; i < MILL; i += 10)
{
if(i >= 1440000) output++;
}
return output;
}