Thanks for your help histrungalot, I have edited my code and tried a few different variations but am getting some interesting errors.
Here is my new while loop:
1 2 3 4 5 6 7 8
|
while (a<x, x<b)
{
y = func(x);
area += (w*y);
x += w;
}
|
And the error i am getting is that the left hand operand of the comma in while(a<x, x<b) has no effect.
The other error I am getting is with this section of code:
1 2 3 4 5 6 7
|
double a, b;
double y, w, x, func;
double area = 0.0;
double func(double x) {
return (5*(pow(x,3))+7*(pow(x,2))-3*x+4);
}
|
The error i am getting is that a function-definition is not allowed here before '{' token.
I have tried splitting up the double func and double x, and not defining them in the scope, but am still having issues.
If i leave them out of the scope it tells me that i need to add them in even though put in exactly what you wrote in line 2,3,4 of the function that returns the value of the equation.
then this section as well:
y = func(x);
The error i am getting is that func cannot be used as a function.
I have tried naming the function differently throughout the program, but this yielded no different results.