plz solve the b and c part here is the a part #include using namespace std; //main function int main(){ //declare d1 for degree int d1; //asking user to enter degree cout>d1; //declare array int A1[d1...


plz solve the b and c part here is the a part


#include


using namespace std;


//main function
int main(){


    //declare d1 for degree
    int d1;


    //asking user to enter degree
    cout<"degree of="" the="" polynomial="" :="">
    cin>>d1;


    //declare array
    int A1[d1 + 1];


    //asking user to enter coefficient
    cout<"enter coefficient="" for="" each="" term="" from="" highest="" degree="" to="" the="" lowest="" degree="" :="">
    for(int i = 0; i <= d1;="">
        cin>>A1[i];


   //declare variables
   int k = d1;


   //for loop to print polynomial
    for( int i = 0; i <= d1;="">


        //when coefficient value is not 0 nor 1
        if(A1[i] !=0 && A1[i] != 1 ){

            //print polynomial with variable
            if(i != d1 && i != d1-1){
                cout<>
                cout<><>
            }

            //when it is 2nd last coefficient
            if(i == d1-1)
                cout<><>

            //when it is not 2nd last coefficient
            if(i != d1-1)
                cout<" +="">

            //when it is last element
            if(i == d1)
                cout<>
        }


       //when coefficient value is 1
       if(A1[i] == 1){

        //print polynomial
        if(i != d1 && i != d1-1)
                cout<><>


        if(i == d1-1)
                cout<>


        if(i != d1-1)
                cout<" +="">


        if(i == d1)
               cout<>
      }
    }


return 0;
}


c. Add two polynomials.<br>Prompt the user to enter two polynomials (as above in step a), then add<br>these two polynomials and print out the result.<br>e.g.: for the first polynomial, the user enters 3 for the degree of the<br>polynomial and enters 7, 0, 9, 10 for each term from the highest degree to<br>the lowest degree; for the second polynomial, the user enters 2 for the<br>degree of the polynomial and enters 1, 2, 3 for each term from the highest<br>degree to the lowest degree, then you have:<br>1st polynomial: 7x^3+9x+10<br>2nd polynomial: x^2+2x+3<br>After<br>you<br>add these two polynomials: your have 7x^3+x^2+11x+13.<br>

Extracted text: c. Add two polynomials. Prompt the user to enter two polynomials (as above in step a), then add these two polynomials and print out the result. e.g.: for the first polynomial, the user enters 3 for the degree of the polynomial and enters 7, 0, 9, 10 for each term from the highest degree to the lowest degree; for the second polynomial, the user enters 2 for the degree of the polynomial and enters 1, 2, 3 for each term from the highest degree to the lowest degree, then you have: 1st polynomial: 7x^3+9x+10 2nd polynomial: x^2+2x+3 After you add these two polynomials: your have 7x^3+x^2+11x+13.
3. ADT array-based polynomials<br>a. Input/output<br>Input:<br>(1) The degree of the polynomial (the highest degree of all the terms<br>in the polynomial)<br>(2) The coefficient for each term from the highest degree to the<br>lowest degree<br>Output:<br>Print out the polynomial.<br>e.g.: if user enters 3 for the degree of the polynomial and enters 7, 0, 9, 10<br>for each term from the highest degree to the lowest degree, then the output<br>will be: 7x^3+9x+10<br>b. Evaluation<br>Once the polynomial has been entered by the user, prompt the user to enter<br>the value of x and evaluate the polynomial and print out the value of the<br>polynomial.<br>e.g. if user enter 2 for the value of x (that is, x=1), then you evaluate the<br>polynomial as 7*2^3+9*2+10=84 and you print out the value of the<br>polynomial is 84.<br>

Extracted text: 3. ADT array-based polynomials a. Input/output Input: (1) The degree of the polynomial (the highest degree of all the terms in the polynomial) (2) The coefficient for each term from the highest degree to the lowest degree Output: Print out the polynomial. e.g.: if user enters 3 for the degree of the polynomial and enters 7, 0, 9, 10 for each term from the highest degree to the lowest degree, then the output will be: 7x^3+9x+10 b. Evaluation Once the polynomial has been entered by the user, prompt the user to enter the value of x and evaluate the polynomial and print out the value of the polynomial. e.g. if user enter 2 for the value of x (that is, x=1), then you evaluate the polynomial as 7*2^3+9*2+10=84 and you print out the value of the polynomial is 84.
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here