#include <iostream>
using namespace std; 
int main() {
    float amount; 
    float value (float p, int n, float r=0.15);
    amount =value (5000.00,5);
    cout <<"Final value :"<<amount;
    return 0;
}
float value(float p, int n, float r=0.15)
{
    int year =1;
    float sum =p; 
    while (year <= n)
    {
        sum =sum*(1+r);
        year =year +1;
    }
    return sum; 
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: