Ask Experts Questions for FREE Help !
Ask
    fiza_murtaza's Avatar
    fiza_murtaza Posts: 3, Reputation: 1
    New Member
     
    #1

    Nov 26, 2010, 02:42 AM
    write a program to Overload the addition operator (+) to add two Polynomials.
    Develop class Polynomial. The internal representation of a Polynomial is an array of terms. Each term contains a coefficient and an exponent. The term 2x4
    has a coefficient of 2 and an exponent of 4. Develop a full class containing proper constructor and destructor functions as well as set and get functions. The class should also provide the following overloaded operator capabilities:
    a) Overload the addition operator (+) to add two Polynomials.
    b) Overload the subtraction operator (-) to subtract two Polynomials.
    c) Overload the assignment operator (=) to assign one Polynomial to another.
    d) Overload the multiplication operator (*) to multiply two Polynomials.

    Sample output:


    Enter number of polynomial terms: 2
    Enter coefficient: 2
    Enter exponent: 2
    Enter coefficient: 3
    Enter exponent: 3
    Enter number of polynomial terms: 3
    Enter coefficient: 1
    Enter exponent: 1
    Enter coefficient: 2
    Enter exponent: 2
    Enter coefficient: 3
    Enter exponent: 3
    First polynomial is:
    2x^2+3x^3
    Second polynomial is:
    1x+2x^2+3x^3
    Adding the polynomials yields:
    1x+4x^2+6x^3
    Subtracting the polynomials yields:
    -1x
    Multiplying the polynomials yields:
    2x^3+7x^4+12x^5+9x^6 class Polynomial

Check out some similar questions!

Write a program to Overload the addition operator (+) to add two Polynomials. [ 1 Answers ]

Develop class Polynomial. The internal representation of a Polynomial is an array of terms. Each term contains a coefficient and an exponent. The term 2x4 has a coefficient of 2 and an exponent of 4. Develop a full class containing proper constructor and destructor functions as well as set and get...

Program not in add/remove [ 5 Answers ]

Hi there here we go right a friend of mine has downloaded and antivirus called antivir and it is not in add/remove and you cannot delete the .exe file as she gets access denied and I cannot remember the command line to do it so could someone give me a hand please. Thanks mat

Add Emove program in xp [ 1 Answers ]

Need help restoring missing remove button in add\remove program I am using XP Sp2 IE7


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.