关键字:数据结构,链表,一元多项式
代码清单:
- main.cpp
- Elem.h
- Elem.cpp
- List.h
- List.cpp
- Polyn.h
- Polyn.cpp
Windows7 64位下 Code::Blocks12.11 GCC 编译运行通过。
原文地址:http://www.cnblogs.com/fengzy/archive/2013/06/01/3113039.html
欢迎交流学习,转载请注明出处。如有问题,请留言。
下面是源代码。
-
main.cpp
View Code
1 //----- main.cpp ------ 2 #include <iostream> 3 #include <cassert> 4 #include <stdlib.h> 5 #include "Polyn.h" 6 7 using namespace std; 8 9 #define PRINT(x) cout << #x << " = " << (x) 10 #define READ(x) cout << #x << "'s SIZE: "; (x).read() 11 12 int main() 13 { 14 Polyn Pa, Pb; 15 16 READ(Pa); 17 READ(Pb); 18 19 system("cls"); 20 21 PRINT(Pa); 22 PRINT(Pb); 23 24 PRINT(Pa + Pb); 25 PRINT(Pa - Pb); 26 PRINT(Pb - Pa); 27 PRINT(Pa * Pb); 28 29 return 0; 30 }