-
Notifications
You must be signed in to change notification settings - Fork 0
/
28.cpp
47 lines (28 loc) · 899 Bytes
/
28.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
using namespace std;
double fnDepositAmount(double = 500.0, int =10, double = 8.0);
int main(void)
{
double dPrincipal, dAmount, dRate;
int iYears;
//cout << "\nEnter the principal rate and years" << endl;
//cin >> dPrincipal >> dRate >> iYears;
dAmount = fnDepositAmount(1000,20,5.0);
cout << "\nAmount at the end of term is : " << dAmount << endl;
dAmount = fnDepositAmount(1000,15);
cout << "\nAmount at the end of term is : " << dAmount << endl;
dAmount = fnDepositAmount(1000);
cout << "\nAmount at the end of term is : " << dAmount << endl;
dAmount = fnDepositAmount();
return 0;
}
double fnDepositAmount(double dP, int iY, double dR)
{
double dAm = dP;
int iCount;
for(iCount = 1; iCount <= iY; iCount++)
{
dAm = dAm * (1 + dR/100);
}
return dAm;
}