자료구조
-
다항식계산 :: 자료구조 실습보고서 01 소스정리필요2 2007. 9. 9. 16:14
#include #define MAX_DEGREE 101 #define MAX(a, b) (((a)>(b))? (a):(b)) typedef struct { int degree; float coef[MAX_DEGREE]; }polynomial; polynomial poly_add(polynomial A, polynomial B){ polynomial C; int Apos=0, Bpos=0, Cpos=0; int degree_a = A.degree; int degree_b = B.degree; C.degree = MAX(A.degree, B.degree); while( Apos