开发者

pedometer application

I try to calculate a miles per hours. For this I write a code like this

mint=sec/60;
hour=mint/60;
mph=miles/hour;
nsstring *speed=[nsstring stringwithformat:@"%5.2f",mph];

[mph settext: speed];

I get a miles from this code

miles = (steps *steplength)/1500;
NSString *distance =[NSString stringWithFormat:@"%5.3f",TotalDistance];
[Miles1开发者_StackOverflow setText:distance];

And the error is shown me like this

miles per hour ans is (inf)

help me out


If the minute count is < 60, then hour will be zero (if that's an integer division) and mph becomes inf.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜