![]() |
Finance Functions: |
|
The InterestRate() function is used to find the interest applied to a loan. Its syntax is:
Extended __fastcall InterestRate(int NPeriods,
constExtended Payment,
const Extended PresentValue,
const Extended FutureValue,
TPaymentTime PaymentTime);
All of the arguments are the same as described for the InterestPayment() function. Here is an example: ![]() //---------------------------------------------------------------------------
void __fastcall TForm1::btnCalculateClick(TObject *Sender)
{
Extended Present, Future, Payments, Rate;
int NPeriod;
Present = StrToFloat(edtPresent->Text);
Future = StrToFloat(edtFuture->Text);
Payments = StrToFloat(edtPayments->Text);
NPeriod = StrToInt(edtNPeriods->Text);
Rate = InterestRate(NPeriod, Payments, Present, Future, ptEndOfPeriod) * 12 * 100;
AnsiString Value = FloatToStrF(Rate, ffGeneral, 3, 2);
edtRate->Text = Value + "%";
}
//---------------------------------------------------------------------------
|
| Home | Copyright © 2004-2016, FunctionX, Inc. | |