0

```
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
// Declare constants and variables
const double ACCURACY = 0.00001;
double x, factorial, ex_approx, ex_funct, curr_term;
int terms, i;
// Read value of x for exp(x) calculation
cout << "Enter the value of x you wish to use for exp(x) approximation\n";
cin >> x;
// Calculate exp(x) using library function
ex_funct = exp(x);
// Initialization
ex_approx = 1; // first term in approximation
terms = 1;
// Approximate exp(x) term by term
while((ex_funct - ex_approx) > ACCURACY)
{
// Calculate terms!
factorial = 1;
for (i=1; i<= terms; i++)
factorial = factorial * i;
// Calculate new term
curr_term = pow(terms, x)/factorial;
// Update number of terms used
terms++;
}
cout << "x = " << x << " the approximation = " << ex_approx << " exp(x) = " << ex_funct
<< "the number of terms is " << terms + 1<< endl;
}
```

I cant figure out what I am dong wrong

sorry