Search
 
SCRIPT & CODE EXAMPLE
 

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; 

Comment

PREVIOUS NEXT
Code Example
Cpp :: vector iterating in c++ 
Cpp :: find substring in string c++ 
Cpp :: getline() 
Cpp :: c++ class template 
Cpp :: set size in c++ 
Cpp :: two elements with difference K in c++ 
Cpp :: C++ Integer Input/Output 
Cpp :: stl function to reverse an array 
Cpp :: how to add space in c++ 
Cpp :: how to make a function in c++ 
Cpp :: dice combinations cses solution 
Cpp :: c++ inheritance constructor 
Cpp :: find pair with given sum in the array 
Cpp :: prevent getting data from data-tooltip-content tippyjs 
Cpp :: long long int range c++ 
Cpp :: one dimensiol array to two dimen c++ 
Cpp :: C++ program to sizes of data types 
Cpp :: matrix c++ 
Cpp :: how to fill vector from inputs c++ 
Cpp :: c++ pass ofstream as argument 
Cpp :: c++ compare type 
Cpp :: cpp malloc 
Cpp :: c++ print array of arrays with pointer 
Cpp :: runtime 
Cpp :: c++ string concatenation 
Cpp :: c++ copy constructor 
Cpp :: c++ vector operations 
Cpp :: remove elements from vector 
Cpp :: Initialize Vector Iterator with end() function 
Cpp :: Maximum Pairwise Modular Sum codechef solution in c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =