计算iPhone的未来价值 [英] calculate Future value in iPhone
本文介绍了计算iPhone的未来价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下功能将基于iphone的现值,利率和时间段来计算未来价值吗?
Will the following function for calculating Future value based on present value, interest rate and time period work in iphone?
-(float) calcFV: float pv: float interest_rate: float time
{
float fv, pv, interest_rate, t;
//pv = 200000.0; // present value
//i = 0.012; // interest rate (1.2%)
//t = 5.0; // time period
fv = pv * pow (1.0 + interest_rate, time);
return fv;
}
推荐答案
是的,
尽管您的公式正确,但您仍在声明pv和interest_rate,并将它们作为参数传递。
Despite the fact that your formula is correct, you are declaring pv and interest_rate, as well as passing them in as parameters.
删除声明:
-(float) calcFVFromPresentValue: (float) pv interest_rate: (float) interest_rate time: (float) time
{
float fv;
//pv = 200000.0; // present value
//i = 0.012; // interest rate (1.2%)
//t = 5.0; // time period
fv = pv * pow (1.0 + interest_rate, time);
return fv;
}
顺便说一句,您的.h文件现在应具有以下内容:
Incidentally, your .h file should now have this:
-(float) calcFVFromPresentValue: (float) pv interest_rate: (float) interest_rate time: (float) time;
这篇关于计算iPhone的未来价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文