My Homework (I solved it)
Compute two polynominals addition by link list.
Write a progroam compute polynominals addition.
For example:
3x^2 + 4x + 1 and 5x^4 - 6x^2 + x - 3, the result outputs
5x^4 - 3x^2 + 5x - 2.
The input read from a file, which each polynomial is in one line, every two numbers are one term of polynomial, the first is coefficient and the second is exponent. You must implement polynomial by linked list in this program. Your output prints the two polynomials first, and the addition of two polynomial.
(The coefficients and exponents are all integers)
An example of input file:
3 2 4 1 1 0
5 4 -6 2 1 1 -3 0
An example of output:
A(x) = 3x^2 + 4x + 1
B(x) = 5x^4 - 6x^2 + x - 3
A(x) + B(x) = 5x^4 - 3x^2 + 5x - 2
|