Iphone “XCode错误”;二进制表达式“”的操作数无效;
我有一个NSTimeInterval,它存储为双精度。我想使用%运算符获取第二个值内的分钟数Iphone “XCode错误”;二进制表达式“”的操作数无效;,iphone,ios5,xcode4.3,Iphone,Ios5,Xcode4.3,我有一个NSTimeInterval,它存储为双精度。我想使用%运算符获取第二个值内的分钟数 int remainingSeconds = scratch % 60; 错误表示“二进制表达式的操作数无效”指向% 请提供帮助。模数用于整数,因此要使代码正常工作,请执行以下操作 int remainingSeconds = (int)scratch % 60; 要在浮子上使用模数,请使用fmod int remainingSeconds = fmod(scratch, 60); 在这里检查答案
int remainingSeconds = scratch % 60;
错误表示“二进制表达式的操作数无效”指向%
请提供帮助。模数用于整数,因此要使代码正常工作,请执行以下操作
int remainingSeconds = (int)scratch % 60;
要在浮子上使用模数,请使用fmod
int remainingSeconds = fmod(scratch, 60);
在这里检查答案