Please, Help

Hello, I am completely new in programming and I need some help, please.
So the thing is I have to make a program which equals that function : f(x)=xe^x and I need to enter x and n. (this is the function of Maclaren).
And I need to make it by using arrays in C++
Please help, I'll be really thankful!

Last edited on
This is not a homework site. We won't do your homework for you. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again. As it is impossible to find derivative of function without knowledge in arithmetic, you cannot do more complex tasks in programming without clear understanding of basics
I'm apologize about my stupid question, You are right!
So the thing is I can do it by using only simple variables, but I don't know how to do it by using arrays.
Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
   #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
double fact = 1, sum = 1, step, x;
cout<<"Please enter value for x: ";
cin>>x;

cout<<"Please enter value for n: ";
cin>>n;
for(int i=1; i<=n; i++){

fact = fact * i;
step = pow(x, i)/fact;
sum =sum + step;
}
cout<<sum<<endl;

return 0;
}
           


If somebody can help me I'll be so thankful!
Thanks a lot in advance! :)
Topic archived. No new replies allowed.