1) what about X?
2) very similar issue has been discussed here: http://cplusplus.com/forum/beginner/13130/
3) at least show us what you already did or what's your problem with it
#include <iostream>
#include <cmath> //for pow(double a,double b)
usingnamespace std;
int main()
{
int n;
double x;
//we initialize the result with "1", so we will deal only with computing the n number of fractions
//in fact, we can change this line to 'result = 0', all we will have to do is change the parameters
//inside the loop, since 1 = x0/1!
double result = 1;
//I don't know if you already got this in school, but i assume you have some idea about factorials
//and way to compute it
double factorial = 1;
cout<<"Insert X: ";
cin>>x;
cout<<"Insert n: ";
cin>>n;
for(int i = 1; i <= n; i++)
{
factorial *=(i+1); //factorial = (i+1)*factorial; i+1, since we start from 2!
result += pow(x,i)/factorial;
}
cout<<"Result is: "<<result;
return 0;
}
hope this helps, you can also make this, by using recursion - I leave it to you as an extra HW