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;