The code you have above compiles and runs (although I had to remove the system("pause")) . It also compiles and runs if you remove the comment on the start of the line:
|
//term_two = 2 * sum_one;
|
I note that at the end, you create a double value called error, that is never used.
Here's an example run and also some warnings from a compile with -Wall switch:
$ ./a.exe
Enter the degree of the polynomial: 65
Error: degree of polynomial must be 4 or 5
Enter the degree of the polynomial: 5
Enter the x^5 coefficient: 5
Enter the x^4 coefficient: 4
Enter the x^3 coefficient: 3
Enter the x^2 coefficient: 2
Enter the x^1 coefficient: 1
Enter the x^0 coefficient: 3
Enter the lower limit for the definite integral: 10
Enter the upper limit for the definite integral: 90
Enter the number of subintervals for the approximation: 6
3.38759e+08
5.49873e+09
5.49873e+09Term one =2.41428e+06
term four = 1.32396e+11
$ g++ -Wall 02.cpp
02.cpp: In function 'int main()':
02.cpp:138: warning: left-hand operand of comma has no effect
02.cpp:129: warning: unused variable 'estimate'
02.cpp:154: warning: unused variable 'error'