So I have this so far, not sure how to make dollars * e^(rate*time)

``````#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main()
{
//declare identifiers
double rate = 1;
double time = 2;
float dollars;
float total=0.0;

//initialize identifiers
total= pow(exp(1.0), rate*time);

cout << fixed << showpoint << setprecision(2);

//Enter values
cout << "Enter the money you want to deposit now(P): " << dollars;
cout << "Enter the interest rate: " << rate;
cout << "Enter duration in year(t): " << time;
cout << "   Your balance after 5 years is " << total;

cout << endl;

//terminate program
system("pause");
return 0;
}
``````

## All 3 Replies

Why do you want to continuously compound interest? It is theoretical text book stuff, in practice, it should be simple interest formula.

Ya I got it nevermind, thanks anyways.

``````1.#include <iostream.h>
2.#include <conio.h>
3.#include <math.h>
4.#include <iomanip.h>
5.#include <graphics.h>
6.//using namespace std;
7.int main()
8.{
9    clrscr();
10    //declare identifiers
11    double rate;
12    double time;
13    float dollars;
14    float total;
15    //initialize identifiers
16    cout << setprecision(2);
17    //Enter values
18    cout << "Enter the money you want to deposit now(P): ";
19    cin >> dollars;
20    cout << "Enter the interest rate: ";
21    cin >> rate;
22    cout << "Enter duration in year(t): ";
23    cin >> time;
24    total= dollars * exp(rate*time);
25    cout << "Your balance after the end of the given year is " << total;
26    //terminate program
27    getch();
28    return 0;
29}
``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.