} Term t(0,1); // construct a term 1x^0 ­> 1 Polynomial p3; p3.InsertTerm(t); // initialize the polynomial with 1 p3 *= p1; // Note: p1 aleady has the previous polynomial addition result p3 *= p2; // multiply the above resultant polynomial with the second polynomial k = 7; for(int o=0;o<4;o++){ // print the result polynomial in four different orders p3.Sort(o); cout << “Polynomial ” << k << “ (order = ” << o << “) = ” << p3; k++; } return 0; }

Remember that no line in the above main() function can be modified in your program ( 你的程式中不得修改上面 main() 函數中任何一行指令 ). If you cannot produce correct outputs for the given main() function, that would be meaning that somewhere in your designis wrong. Example Content of Data1.txt ( − 1 − 2x + x2 ) 0 ­1 1 ­2 2 1 ­1 Example Content of Data2.txt( 2 − 2x2 + x3 ) 0 2 2 ­2 3 1 ­1 Example Outputs of main(): Polynomial 1 = ­1­2x+x^2 Polynomial 2 = 2­2x^2+x^3 Polynomial 3 (order = 0) = 1­2x­x^2+x^3 Polynomial 4 (order = 1) = x^3­x^2­2x+1 Polynomial 5 (order = 2) = 1­x^2+x^3­2x Polynomial 6 (order = 3) = ­2x+x^3­x^2+1 Polynomial 7 (order = 0) = 2­4x­4x^2+7x^3­3x^5+x^6 Polynomial 8 (order = 1) = x^6­3x^5+7x^3­4x^2­4x+2 Polynomial 9 (order = 2) = x^6+2­3x^5­4x­4x^2+7x^3 Polynomial 10 (order = 3) = 7x^3­4x^2­4x­3x^5+2+x^6 Some Required Header Files #include <iostream> #include <list> #include <fstream> #include <vector> #include <string>

Note: The above contents for data1.txt and data2.txt are just for your own testing. The teacher will test your program with different contents in data1.txt and data2.txt.

1371213167421510229_