0

Hi I need help with finding the area underneath a curve. Here is what I have so far;

```
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
struct term
{
float coeF;
float exP;
char name;
};
struct function
{
int size;
term terms[10];
};
struct Integral
{
float lowerBound;
float upperBound;
function func;
};
float findHeightOfFunction(function func, float x);
int main()
{
Integral integral;
char userContinue = 'y';
for(int i=0;i<10;i++)
{
//fill the term
cout<<"Enter in a coefficient: ";
cin>>integral.func.terms[i].coeF;
cout<<"Enter in an exponent: ";
cin>>integral.func.terms[i].exP;
cout<<"Do you want to enter in more terms: ";
cin>>userContinue;
if(userContinue != 'y')
{
break;
}
}
cout<<"Enter in the lower bound: ";
cin>>integral.lowerBound;
cout<<"Enter in the upper bound: ";
cin>>integral.upperBound;
//integral is filled, find area under curve
float sum = 0.0;
for(float x = integral.lowerBound; x < integral.upperBound; x = x + .001)
{
sum = sum + (.001 * findHeightOfFunction (integral.func, x ));
}
return sum;
system("pause");
return 0;
}
float findHeightOfFunction(function func, float x)
{
}
integral.f.terms[i].coefficient*pow(X,integral.f.terms[i].exponent);
// pow function here....
//integral.f.terms[?].coefficient*pow(X,integral.f.terms[ ? ].exponent);
//for(int i=a i++)
//Need Loop to Find Height
```

any help is appreciated.

Thaks