Find Are underneath curve, using array, structs & functions for 10 terms

OS Windows 7, Visual Studio 2012.

I'm building a program to calculate the area underneath a curve using:

Struct
Array

User will be able to enter up to 10 Terms

I need guidance as to what comes next, I think at this point I need a loop but I need guidance. Any advice is greatly appreciated.

My programs doesn't compile right now and I'm getting this error when I try to compile & run:
'"C:\Users\Me\Documents\Visual Studio 2012\Projects\MyProject150713\Debug\MyProject 150713.exe"'
is not recognized as an internal orexternal command,

operable program or batch file.
Press any key to continue...

I'm not going to worry about the error because I think it's because of problems with my code.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#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;
	};

	//protoype

	int _tmain(int argc, _TCHAR* argv[])
	{
	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)
	{
	
	}
Topic archived. No new replies allowed.