ios 基礎運算法則 求百分比

int a=1;
int b=2;
NSInteger a1=1;
NSInteger b1=2;

NSLog(@"%.2f",(float)a1/b1);//ok
NSLog(@"%.2f",(float)a/b);//ok
NSLog(@"%.2f",(float)(a/b));//error;
相關文章
相關標籤/搜索