answersLogoWhite

0

#include<iostream.h>

#include<stdlib.h>

#include<conio.h>

struct poly

{

int coeff;

int x;

int y;

int z;

struct poly * next;

};

class polynomial

{

private :

poly *head;

public:

polynomial():head(NULL)

{

}

void getdata();

void display();

void insert(poly *prv,poly *curr,poly *p);

polynomial operator + (polynomial );

};

polynomial polynomial :: operator +(polynomial px2)

{

polynomial px;

poly *t1,*t2,*t3,*last;

t1 = head;

t2 = px2.head;

px.head = NULL;

while(t1 != NULL && t2 != NULL)

{

t3 = new poly;

t3->next = NULL;

if(t1->x NULL)

{

head->next = node;

node->next = NULL;

}

else

insert(head,head->next,node);

}

}

void polynomial :: display()

{

poly *temp;

temp = head;

cout << endl << "Polynomial :: ";

while(temp != NULL)

{

if(temp->coeff < 0)

cout << " - ";

cout << abs(temp->coeff);

if(temp->x != 0)

cout << "x^" << temp->x;

if(temp->y != 0)

cout << "y^" << temp->y;

if(temp->z != 0)

cout << "z^" << temp->z;

if(temp->next->coeff > 0)

cout << " + ";

temp = temp->next;

}

cout << " = 0";

}

void main()

{

polynomial px1,px2,px3;

clrscr();

px1.getdata();

px2.getdata();

px3 = px1 + px2;

px1.display();

px2.display();

px3.display();

getch();

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Is it possible to add 2 polynomials together and your answer is not a polynomial?

No. Even if the answer is zero, zero is still a polynomial.


How do you add polynomials?

homer Simpson


Are polynomials a closed set under addition?

Yes, polynomials are a closed set under addition. This means that if you take any two polynomials and add them together, the result will also be a polynomial. The sum of two polynomials retains the structure of a polynomial, as it still consists of terms with non-negative integer exponents and real (or complex) coefficients.


Is 4 - 3x plus 5x2 a polynomial?

Yes. If you add, subtract or multiply (but not if you divide) any two polynomials, you will get a polynomial.


Hellllp meee. How do you add polynomials when you don't have any like terms?

Hellllp meee, how do you add polynomials when you don't have any like terms is a very common questions when it comes to this type of math. However, the polynomials can only be added if all terms are alike. No unlike terms can be added within the polynomials.


Will the product of two polynomials always be a polynomial?

Yes, the product of two polynomials will always be a polynomial. This is because when you multiply two polynomials, you are essentially combining like terms and following the rules of polynomial multiplication, which results in a new polynomial with coefficients that are the products of the corresponding terms in the original polynomials. Therefore, the product of two polynomials will always be a polynomial.


Can the sum of three polynomials again be a polynomial?

The sum of two polynomials is always a polynomial. Therefore, it follows that the sum of more than two polynomials is also a polynomial.


What are the rules in addition of polynomials?

Add together the coefficients of "like" terms. Like terms are those that have the same powers of the variables in the polynomials.


When you multiply polynomials what do you do with the exponents?

Add them up providing that the bases are the same.


Give examples of some kinds of polynomials?

Binomials and trinomials are two types of polynomials. The first has two terms and the second has three.


Which property of polynomial subtraction says that the difference of two polynomials is always a polynomial?

The property that states the difference of two polynomials is always a polynomial is known as the closure property of polynomials. This property indicates that when you subtract one polynomial from another, the result remains within the set of polynomials. This is because polynomial operations (addition, subtraction, and multiplication) preserve the degree and structure of polynomials. Thus, the difference of any two polynomials will also be a polynomial.


Are polynomials closed under the operations of subtraction addition and multiplication?

Yes, polynomials are closed under the operations of addition, subtraction, and multiplication. This means that when you add, subtract, or multiply two polynomials, the result is always another polynomial. For example, if ( p(x) ) and ( q(x) ) are polynomials, then ( p(x) + q(x) ), ( p(x) - q(x) ), and ( p(x) \cdot q(x) ) are all polynomials as well. However, polynomials are not closed under division, as dividing one polynomial by another can result in a non-polynomial expression.