Microsoft Word - Project 4 CSC.docx

1 answer below »
Attached in the file below.


Microsoft Word - Project 4 CSC.docx
Answered Same DayNov 18, 2021

Answer To: Microsoft Word - Project 4 CSC.docx

Ria answered on Nov 19 2021
145 Votes
#include
#include
using namespace std;
// initialize degree
int degree = 0;

// all user define functions
string ptos(const double[]);
double pEval(const double[], double);
void pExtrema(const double[], double, double, double, double*, double*);
double nIntegrate(const double[], double, double, double);
// main function
int main()
{
    // read the degree of the polynomial
    cout << "Enter the degree of the polynomial -> ";
    cin >> degree;
    // read the coefficients
    double* poly = new double[degree + 1];
    cout << "Enter the coefficients -> ";
    for (int i = degree; i >= 0; i--) cin >> poly[i];
    // convert polynomial to string and display
    cout << "\nf(x) = ";
    string str = ptos(poly);
    cout << str;
    // read a point
    cout << "\nEnter x at which to evaluate f(x) -> ";
    double x = 0;
    cin >> x;
    // display polynomial value of the point
    double val = pEval(poly, x);
    cout << "f(" << x << ") = " <<...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here