gpt4 book ai didi

iphone - 在 iOS 应用程序中使用 mod 运算符

转载 作者:行者123 更新时间:2023-12-03 18:33:47 25 4
gpt4 key购买 nike

我有一个存储为 double 的 NSTimeInterval。我想使用 % 运算符获取第二个值内的分钟数。

minutes = secondValue % 60;

其中分钟被声明为双分钟

结果是 XCode 说“二进制 % 的操作数无效”

想法?

最佳答案

摘自 C 标准,6.5.5 乘法运算符部分,第 2 段:

The operands of the % operator shall have integer type.

关于iphone - 在 iOS 应用程序中使用 mod 运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3731167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com