Jun 9, 2009

float returnangle(int hour,int min) so basically at 2:00 the angle is 60deg, the function should return 60.

float returnangle(int hour,int min)
so basically at 2:00 the angle is 60deg, the function should return 60.
float returnangle(int hour,int min)
{
int hourA=hour*30+30*min/60;
int minA=360*min/60;
if(hourA>minA)
return hourA-minA>180?hourA-minA:360-(hourA-minA);
else
return minA-hourA>180?minA-hourA:360-(minA-hourA);
}

No comments:

Post a Comment