I got this math problem I need to input:

Calculate(find the sum of)

Y=1+X/2+X*X/3+X*X*X/4+...

Keep calculating until Y bigger than Epsilon. X and Epsilon are inpute by the user.

Please help...

summerm111 0 Newbie Poster

I got this math problem I need to input:

Calculate(find the sum of)

Y=1+X/2+X*X/3+X*X*X/4+...

Keep calculating until Y bigger than Epsilon. X and Epsilon are inpute by the user.

Please help...

Salem 5,180 Posting Sage

So what are you stuck on?

- reading input

- evaluating the expression to a fixed number of terms

- evaluating to as many terms as it takes.

As the readme's at the top of the forum say, no free homework without effort.

Show us where you're at, and we'll help you from there.

summerm111 0 Newbie Poster

So what are you stuck on?

- reading input

- evaluating the expression to a fixed number of terms

- evaluating to as many terms as it takes.As the readme's at the top of the forum say, no free homework without effort.

Show us where you're at, and we'll help you from there.

Im sorry to be pushing this on anyone I know that its the worst thing I could do but believe me when im saying if I wasnt between a rock and a hard place Id study as much as I could and just do this thing... I basicaly dont understand how I should approach this problem the teacher said that Ive should use the "for" function all I did was get to this and then just couldnt make the problem---->>>>(please help) and maybe there is a site you could recomand that has some tutorials to learn better... but right now I do not have any time at all between my Job and after work I come home to this homework and a lot of other assignments...

double X,eps,Y,b;

cout<<"eps=? ";

cin>>eps;

cout<<"X=? ";

cin>>X;

for ()

}while(Y>eps);

And one more question...>>>other homework Is there a way to set an array not specifying the number of cells and the numbers in them?

Salem 5,180 Posting Sage

Well you could use a for loop, but I would suggest something like

```
do {
Y = Y + /* the next term in the series */
} while ( Y < eps );
```

To calculate the next term, you just need another variable to count 1, 2, 3 etc.

> Is there a way to set an array not specifying the number of cells and the numbers in them?

If you have `int array[5]; // compile time`

You can also do

```
int size = 5; // or input from the user
int *array = new int[size]; // run-time
```

Be a part of the DaniWeb community

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