How to make my calculator compute time correctly

2019-09-22 07:37发布

问题:

I'm working with iOS 4, Objective C. This is the code I have now.

float minutes = ([time.text floatValue]);
float miles = minutes/([distance.text floatValue]);

label.text = [[NSString alloc] initWithFormat:@"%.2f", miles];

I want to just multiply the decimal after this is completed. How can i do this?

回答1:

Use the modulus operator: Seconds % 60