i'm supposed to use nested for loops to estimate the value of e and display the estimation through each run. this is what i got so far, but i found out im not supposed to use setprecision so i've done it wrong but don't know what to do to fix it. and then i'm supposed to do the same thing with number e raised to x power
#include <iostream>
using std::endl;
using std::cout;
using std::cin;
using std::fixed;
#include <iomanip>
using std::setw;
using std::setprecision;
using std::setiosflags;
using std::ios;
int main ()
{
//declaration block
double numE = 1;
double accuracyOfe;
double count1;
double count2 = 1;
double x;
double count3 = 1;
double count4;
//Prompt user for desired accuracy of number e
cout << "Enter the number of decimal places (From 1 to 15)\n"
<< "you would like the number e produced to: ";
cin >> accuracyOfe;
cout << endl;
//
if (accuracyOfe >= 1 && accuracyOfe <= 15)
{
accuracyOfe += 3;
for ( count1 = 1; accuracyOfe >= count1; count1++)
{
count2 *= count1;
numE += (1/count2);
cout << "The estimation of e is now: " << numE << endl;
for(count4 = 0; accuracyOfe >= count4; count4++)
}
cout << endl << "The number e to the precision of accuracy of "
<< (accuracyOfe - 3) << " is: " << setprecision(accuracyOfe - 3)
<< numE << "." << endl << endl;
}
else
{
cout << "The number you entered was in the range specified, Sorry." << endl;
}
//reset values of variables
numE = 1;
count2 =1;
cout << "Enter the number of decimal places (From 1 to 15)\n"
<< "you would like the number e produced to: ";
cin >> accuracyOfe;
cout << endl;
cout << "Enter the value of x: ";
cin >> x;
cout << endl;
//
if (accuracyOfe >= 1 && accuracyOfe <= 15)
{
if (x >= -1 && x <= 1)
{
accuracyOfe += 3;
for ( count1 = 1; accuracyOfe >= count1; count1++)
{
count2 *= count1;
count3 *= x;
numE += (count3/count2);
cout << "The estimation of e to the x is now: "
<< setprecision(count1) << numE << endl;
}
cout << endl << "The number e to the x to the precision of "
<< (accuracyOfe - 3) << " decimal places is: "
<< setprecision(accuracyOfe - 3) << numE << "." << endl << endl;
}
else
cout << "The number you entered for x was "
<< "in the range specified, Sorry." << endl;
}
else
cout << "The number you entered was in the range specified, Sorry." << endl;
return 0;
}