我正在使用sqlite。 stringFloat1 = [pediDetails.doseTo FloatValue];
float mulWith1 = [appDelegate.selectedWeight FloatValue];
NSLog(@"mulwith1:%f",mulWith1);
//if(mulWith1 =0.00) {
// int temp1=0;
//}
// else {
float temp1 = stringFloat1*mulWith1;
NSString *setWeight;
NSLog(@"temp1:%f",temp1);
// }
//float temp1;
//NSString *setWeight = [NSString stringWithFormat:@"%.02f",temp,temp1];
//if(temp1=0.00) {
//setWeight = [NSString stringWithFormat:@"%.02f",temp];
//}
//else{
setWeight = [NSString stringWithFormat:@"%.02f-%.02f",temp,temp1];
我需要的是,如果temp1为0.00,则只显示临时值。条件是什么?
答案 0 :(得分:1)
使用
if(temp1==0.00)
{
setWeight = [NSString stringWithFormat:@"%.02f",temp];
}
而不是
if(temp1=0.00)
{
setWeight = [NSString stringWithFormat:@"%.02f",temp];
}