I've looked into all the other threads and I am still lost.
#include<iostream>
#include<cmath>
using namespace std;
//Prototype's
//////////////////////////////
double functiony(double);
double area(int, double, double);
// Main
//////////////////////////////
int main (void)
{
//Solving for y=x^3 using k as y and d as x
double k;
double d=0;
k = functiony(d);
//Intergration
double sum;
sum = area (60, 1,8);
cout<<sum<<endl;
return(0);
}
// Function definitions
//////////////////////////////
//Calling y which I call k and d is x;
void functiony()
{ double k;
k=d*d*d;
return(k);
}
}
//Intergration f is number of rectangles, g is x1 and h is x2, d is x.
double area(int f, double g, double h)
{ double sum, step, d, k, area;
step = (g-h)/f;
sum=0;
d=0;
for (int i=1;i<=f;i++)
{ area=k*step;
sum=sum+area;
d=d+step; }
return(sum);
}
my integration function works when I give k a value inside the function, I need to create k as a separate function, which I did, I'm just lost on where I can put it so the program will bring it into my integration function