Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having a huge headache. Help with any part of thiscode will be appreciated.

ID: 3616753 • Letter: I

Question

I am having a huge headache. Help with any part of thiscode will be appreciated. I will work on it some more, but pleaseprovide me with anything you may offer. I have included what I needdone within the code. Thank you!! UPDATE: see bottom post for code. Hereis a sample output:
1. 2. This program finds definite integral 3. of polynomial on [a,b] 4. 5. 0. Quit 6. 1. Enter polynomial 7. 2. Print polynomial 8. 3. Integrate 9. 10. Enter your choice : 2 11. Enter the polynomial first 12. 0. Quit 13. 1. Enter polynomial 14. 2. Print polynomial 15. 3. Integrate 16. 17. Enter your choice : 1 18. Enter degree of a polynom between 1 and 10 : -5 19. Enter degree of a polynom between 1 and 10 : 12 20. Enter degree of a polynom between 1 and 10 : 6 21. Enter space separated coefficients starting fromhighest degree 22. 1 -4 6.7 31 -9 5 2 23. 0. Quit 24. 1. Enter polynomial 25. 2. Print polynomial 26. 3. Integrate 27. 28. Enter your choice : 2 29. x^6-4*x^5+6.7*x^4+31*x^3-9*x^2+5*x+2 30. 0. Quit 31. 1. Enter polynomial 32. 2. Print polynomial 33. 3. Integrate 34. 35. Enter your choice : 3 36. Enter integration limits a b : -6 5.1 37. Integral of f(x) equals to 81377.6 38. 0. Quit 39. 1. Enter polynomial 40. 2. Print polynomial 41. 3. Integrate 42. 43. Enter your choice : 3 44. Enter integration limits a b : -4 7 45. Integral of f(x) equals to 83688.4 46. 0. Quit 47. 1. Enter polynomial 48. 2. Print polynomial 49. 3. Integrate 50. 51. Enter your choice : w 52. 'w' is an invalid choice 53. Enter your choice : 1 54. Enter degree of a polynom between 1 and 10 : 10 55. Enter space separated coefficients starting fromhighest degree 56. -1 0 0 1 -2 0 2 -3 -5 0 -1 57. 0. Quit 58. 1. Enter polynomial 59. 2. Print polynomial 60. 3. Integrate 61. 62. Enter your choice : 2 63. -x^10+x^7-2*x^6+2*x^4-3*x^3-5*x^2-1 64. 0. Quit 65. 1. Enter polynomial 66. 2. Print polynomial 67. 3. Integrate 68. 69. Enter your choice : 1 70. Enter degree of a polynom between 1 and 10 : 10 71. Enter space separated coefficients starting fromhighest degree 72. 1 0 0 -1 2 0 -2 3 5 0 1 73. 0. Quit 74. 1. Enter polynomial 75. 2. Print polynomial 76. 3. Integrate 77. 78. Enter your choice : 2 79. x^10-x^7+2*x^6-2*x^4+3*x^3+5*x^2+1 80. 0. Quit 81. 1. Enter polynomial 82. 2. Print polynomial 83. 3. Integrate 84. 85. Enter your choice : 0 I am having a huge headache. Help with any part of thiscode will be appreciated. I will work on it some more, but pleaseprovide me with anything you may offer. I have included what I needdone within the code. Thank you!! UPDATE: see bottom post for code. Hereis a sample output:
1. 2. This program finds definite integral 3. of polynomial on [a,b] 4. 5. 0. Quit 6. 1. Enter polynomial 7. 2. Print polynomial 8. 3. Integrate 9. 10. Enter your choice : 2 11. Enter the polynomial first 12. 0. Quit 13. 1. Enter polynomial 14. 2. Print polynomial 15. 3. Integrate 16. 17. Enter your choice : 1 18. Enter degree of a polynom between 1 and 10 : -5 19. Enter degree of a polynom between 1 and 10 : 12 20. Enter degree of a polynom between 1 and 10 : 6 21. Enter space separated coefficients starting fromhighest degree 22. 1 -4 6.7 31 -9 5 2 23. 0. Quit 24. 1. Enter polynomial 25. 2. Print polynomial 26. 3. Integrate 27. 28. Enter your choice : 2 29. x^6-4*x^5+6.7*x^4+31*x^3-9*x^2+5*x+2 30. 0. Quit 31. 1. Enter polynomial 32. 2. Print polynomial 33. 3. Integrate 34. 35. Enter your choice : 3 36. Enter integration limits a b : -6 5.1 37. Integral of f(x) equals to 81377.6 38. 0. Quit 39. 1. Enter polynomial 40. 2. Print polynomial 41. 3. Integrate 42. 43. Enter your choice : 3 44. Enter integration limits a b : -4 7 45. Integral of f(x) equals to 83688.4 46. 0. Quit 47. 1. Enter polynomial 48. 2. Print polynomial 49. 3. Integrate 50. 51. Enter your choice : w 52. 'w' is an invalid choice 53. Enter your choice : 1 54. Enter degree of a polynom between 1 and 10 : 10 55. Enter space separated coefficients starting fromhighest degree 56. -1 0 0 1 -2 0 2 -3 -5 0 -1 57. 0. Quit 58. 1. Enter polynomial 59. 2. Print polynomial 60. 3. Integrate 61. 62. Enter your choice : 2 63. -x^10+x^7-2*x^6+2*x^4-3*x^3-5*x^2-1 64. 0. Quit 65. 1. Enter polynomial 66. 2. Print polynomial 67. 3. Integrate 68. 69. Enter your choice : 1 70. Enter degree of a polynom between 1 and 10 : 10 71. Enter space separated coefficients starting fromhighest degree 72. 1 0 0 -1 2 0 -2 3 5 0 1 73. 0. Quit 74. 1. Enter polynomial 75. 2. Print polynomial 76. 3. Integrate 77. 78. Enter your choice : 2 79. x^10-x^7+2*x^6-2*x^4+3*x^3+5*x^2+1 80. 0. Quit 81. 1. Enter polynomial 82. 2. Print polynomial 83. 3. Integrate 84. 85. Enter your choice : 0 1. 2. This program finds definite integral 3. of polynomial on [a,b] 4. 5. 0. Quit 6. 1. Enter polynomial 7. 2. Print polynomial 8. 3. Integrate 9. 10. Enter your choice : 2 11. Enter the polynomial first 12. 0. Quit 13. 1. Enter polynomial 14. 2. Print polynomial 15. 3. Integrate 16. 17. Enter your choice : 1 18. Enter degree of a polynom between 1 and 10 : -5 19. Enter degree of a polynom between 1 and 10 : 12 20. Enter degree of a polynom between 1 and 10 : 6 21. Enter space separated coefficients starting fromhighest degree 22. 1 -4 6.7 31 -9 5 2 23. 0. Quit 24. 1. Enter polynomial 25. 2. Print polynomial 26. 3. Integrate 27. 28. Enter your choice : 2 29. x^6-4*x^5+6.7*x^4+31*x^3-9*x^2+5*x+2 30. 0. Quit 31. 1. Enter polynomial 32. 2. Print polynomial 33. 3. Integrate 34. 35. Enter your choice : 3 36. Enter integration limits a b : -6 5.1 37. Integral of f(x) equals to 81377.6 38. 0. Quit 39. 1. Enter polynomial 40. 2. Print polynomial 41. 3. Integrate 42. 43. Enter your choice : 3 44. Enter integration limits a b : -4 7 45. Integral of f(x) equals to 83688.4 46. 0. Quit 47. 1. Enter polynomial 48. 2. Print polynomial 49. 3. Integrate 50. 51. Enter your choice : w 52. 'w' is an invalid choice 53. Enter your choice : 1 54. Enter degree of a polynom between 1 and 10 : 10 55. Enter space separated coefficients starting fromhighest degree 56. -1 0 0 1 -2 0 2 -3 -5 0 -1 57. 0. Quit 58. 1. Enter polynomial 59. 2. Print polynomial 60. 3. Integrate 61. 62. Enter your choice : 2 63. -x^10+x^7-2*x^6+2*x^4-3*x^3-5*x^2-1 64. 0. Quit 65. 1. Enter polynomial 66. 2. Print polynomial 67. 3. Integrate 68. 69. Enter your choice : 1 70. Enter degree of a polynom between 1 and 10 : 10 71. Enter space separated coefficients starting fromhighest degree 72. 1 0 0 -1 2 0 -2 3 5 0 1 73. 0. Quit 74. 1. Enter polynomial 75. 2. Print polynomial 76. 3. Integrate 77. 78. Enter your choice : 2 79. x^10-x^7+2*x^6-2*x^4+3*x^3+5*x^2+1 80. 0. Quit 81. 1. Enter polynomial 82. 2. Print polynomial 83. 3. Integrate 84. 85. Enter your choice : 0

Explanation / Answer

please rate - thanks that now works //Having trhouble trying to constantly loop until 0 is pressed.Eliminates at line 43(i believe) //Use prototypes listed at bottom of code (descriptions for eachprovided #include #include using namespace std; int getChoice(); int firstChoice(); double f(double x, double coef[], int n); double integral(double a, double b, double coef[], int n); void print_polynomial(double coef[], int n); int main (void) {     int userChoice;     cout choice;     } if (choice != 0 && choice != 1 && choice != 2&& choice != 3) {     cout choice;    while (choice != 0 && choice != 1 &&choice != 2 && choice != 3)     {     cout