Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Function to calculate compound interest in C++

float CoumpoundInterest (float AmountP,float rateP, int termP)//Define the function and FORMAL parameters
{
    rateP=rateP/100;
    float calculation = AmountP * pow(1+rateP,termP);
    return calculation;

}
//CALLING THE FUNCTION IN THE MAIN PROGRAM: 

//Declaration of ACTUAL paramters 
float amount,rate, total;
int term;

//Assignment statement to call the function.

cout.setf(ios::fixed);
cout.precision(2);
total=CompoundInterets(amount,rate,term)

//OUTPUT
cout<<total; 

Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Function #calculate #compound #interest
ADD COMMENT
Topic
Name
5+2 =