如何生成一个小数点后两位的浮点数数组
How to generate an array of float number with 2 decimal place
我想要一个像这样的浮点数数组:
{0.25, 0.50, 0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25,..100}
如何使用代码生成 100?
在Objective-C (iOS):
NSMutableArray *array = [NSMutableArray array];
for (float i = 0.25; i <= 100; i = i + 0.25)
[array addObject:@(i)];
我想要一个像这样的浮点数数组: {0.25, 0.50, 0.75, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25,..100}
如何使用代码生成 100?
在Objective-C (iOS):
NSMutableArray *array = [NSMutableArray array];
for (float i = 0.25; i <= 100; i = i + 0.25)
[array addObject:@(i)];