# Untitled

unknown
plain_text
a year ago
1.9 kB
0
Indexable
Never
```PS D:\ck107\Desktop\vscode\.vscode\notes\111二下課程\資結\作業\HW1\Q1> .\ADT_2_3_Polynomial.exe
---Demo Round 1---
(Ex: 5x^3 + 4x^7 + 8x^0 -> input: 5 3 4 7 8 0)
Enter Polynomial 1: 5 3 4 7 8 0
Enter Polynomial 2: 1 3 5 7 2 4 6 8

Polynomial 1 is: 4x^7 + 5x^3 + 8x^0
Polynomial 2 is: 6x^8 + 5x^7 + 2x^4 + 1x^3

Polynomail 1 + Polynomial 2 = 6x^8 + 9x^7 + 2x^4 + 6x^3 + 8x^0

**Multiplication**
Polynomial 1 * Polynomial 2 = 24x^15 + 20x^14 + 38x^11 + 29x^10 + 48x^8 + 50x^7 + 5x^6 + 16x^4 + 8x^3

**Evaluation**
Enter float y: 2
Polynomial 1 = 560 at y = 2
Polynomial 2 = 2216 at y = 2

**To test is zero polynomial**
Polynomial 5 is a zero polynomial.
Is Polynomial 5 an zero polynomial? 1
Is Polynomial 1 an zero polynomial? 0

**Coeffient of certain exponent**
Enter exponent x: 7
Coeffient of exponent x in Polynomial 1 is: 4
Coeffient of exponent x in Polynomial 2 is: 5

Lead exponent of Polynomial 1 is: 7
Lead exponent of Polynomial 2 is: 8

---Demo Round 2---
(Ex: 5x^3 + 4x^7 + 8x^0 -> input: 5 3 4 7 8 0)
Enter Polynomial 1: 1.23 4 5 2
Enter Polynomial 2: 4 2 8 3 5 5

Polynomial 1 is: 1.23x^4 + 5x^2
Polynomial 2 is: 5x^5 + 8x^3 + 4x^2

Polynomail 1 + Polynomial 2 = 5x^5 + 1.23x^4 + 8x^3 + 9x^2

**Multiplication**
Polynomial 1 * Polynomial 2 = 6.15x^9 + 34.84x^7 + 4.92x^6 + 40x^5 + 20x^4

**Evaluation**
Enter float y: 2.1
Polynomial 1 = 45.9712 at y = 2.1
Polynomial 2 = 295.933 at y = 2.1

**To test is zero polynomial**
(set polynomial 5 is a zero polynomial.)
Is Polynomial 5 an zero polynomial? 1
Is Polynomial 1 an zero polynomial? 0

**Coeffient of certain exponent**
Enter exponent x: 3
Coeffient of exponent x in Polynomial 1 is: 0
Coeffient of exponent x in Polynomial 2 is: 8