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


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.


What has the author T H Koornwinder written?

T. H. Koornwinder has written: 'Jacobi polynomials and their two-variable analysis' -- subject(s): Jacobi polynomials, Orthogonal polynomials


Rules in adding polynomials?

To add polynomials , simply combine similar terms. Combine similar terms get the sum of the numerical coefficients and affix the same literal coefficient .


What has the author Brian Thomas Smith written?

Brian Thomas Smith has written: 'A zero finding algorithm using Laguerre's method' -- subject(s): Algorithms, Polynomials