0

I am assigning a value to var with calculations but it shows syntax error i have seen all the brackets still it gives error here is my code .

appDelegate.Same_Vaccination_Cost_Treatment_Annually_With_Guarantee=((appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee - 5000) / appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee) * ((appDelegate.Cost_Treatment_SevereEI * appDelegate.Same_Vaccination_SevereEI_Annually) + (appDelegate.Cost_Treatment_ModerateEI * appDelegate.Same_Vaccination_ModerateEI_Annually) + (appDelegate.Cost_Treatment_MildEI * appDelegate.Same_Vaccination_MildEI_Annually)))) * appDelegate.Same_Vaccination_Horses_Per_Premise;

4

3 回答 3

0

根据您的代码:-

    float Same_Vaccination_Cost_Treatment_Annually_With_Guarantee;
    float Cost_Treatment_SevereEI;
    float Same_Vaccination_SevereEI_Annually;
    float Cost_Treatment_MildEI;
    float Same_Vaccination_MildEI_Annually;
    float Same_Vaccination_Horses_Per_Premise;
    float Same_Vaccination_Cost_Treatment_Annually_No_Guarantee;
    float Cost_Treatment_ModerateEI;
    float Same_Vaccination_ModerateEI_Annually;

Same_Vaccination_Cost_Treatment_Annually_With_Guarantee=(((Same_Vaccination_Cost_Treatment_Annually_No_Guarantee - 5000) / Same_Vaccination_Cost_Treatment_Annually_No_Guarantee) * (((Cost_Treatment_SevereEI * Same_Vaccination_SevereEI_Annually) + (Cost_Treatment_ModerateEI * Same_Vaccination_ModerateEI_Annually) + (Cost_Treatment_MildEI * Same_Vaccination_MildEI_Annually)) * Same_Vaccination_Horses_Per_Premise));

你也可以把方法像: -

Same_Vaccination_Cost_Treatment_Annually_With_Guarantee=((Same_Vaccination_Cost_Treatment_Annually_No_Guarantee - 5000) / Same_Vaccination_Cost_Treatment_Annually_No_Guarantee) * ((Cost_Treatment_SevereEI * Same_Vaccination_SevereEI_Annually) + (Cost_Treatment_ModerateEI * Same_Vaccination_ModerateEI_Annually) + (Cost_Treatment_MildEI * Same_Vaccination_MildEI_Annually)) * Same_Vaccination_Horses_Per_Premise;
于 2013-05-15T05:03:50.333 回答
0

如果您使用完全相同

    appDelegate.Same_Vaccination_Cost_Treatment_Annually_With_Guarantee=((appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee - 5000) / appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee) * ((appDelegate.Cost_Treatment_SevereEI * appDelegate.Same_Vaccination_SevereEI_Annually) + (appDelegate.Cost_Treatment_ModerateEI * appDelegate.Same_Vaccination_ModerateEI_Annually) + (appDelegate.Cost_Treatment_MildEI * appDelegate.Same_Vaccination_MildEI_Annually)))) * appDelegate.Same_Vaccination_Horses_Per_Premise;

那么你有 2 个额外的牙套

尝试

    appDelegate.Same_Vaccination_Cost_Treatment_Annually_With_Guarantee=((appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee - 5000) / appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee) * ((appDelegate.Cost_Treatment_SevereEI * appDelegate.Same_Vaccination_SevereEI_Annually) + (appDelegate.Cost_Treatment_ModerateEI * appDelegate.Same_Vaccination_ModerateEI_Annually) + (appDelegate.Cost_Treatment_MildEI * appDelegate.Same_Vaccination_MildEI_Annually)) * appDelegate.Same_Vaccination_Horses_Per_Premise;
于 2013-05-15T05:08:02.580 回答
0

appDelegate.Same_Vaccination_Cost_Treatment_Annually_With_Guarantee=((appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee - 5000) / appDelegate.Same_Vaccination_Cost_Treatment_Annually_No_Guarantee) * ((appDelegate.Cost_Treatment_SevereEI * appDelegate.Same_Vaccination_SevereEI_Annually) + (appDelegate.Cost_Treatment_ModerateEI * appDelegate.Same_Vaccination_ModerateEI_Annually) + (appDelegate.Cost_Treatment_MildEI * appDelegate.Same_Vaccination_MildEI_Annually)) * appDelegate.Same_Vaccination_Horses_Per_Premise;

这将起作用。你使用了太多的括号。

于 2013-05-15T05:08:05.363 回答