Objective-C Float Rounding

前端 未结 7 1487
执念已碎
执念已碎 2020-12-16 09:26

How might I round a float to the nearest integer in Objective-C:

Example:

float f = 45.698f;
int rounded = _______;
NSLog(@\"the rounded float is %i\         


        
相关标签:
7条回答
  • 2020-12-16 09:57

    Check the manual page for rint()

    0 讨论(0)
提交回复
热议问题