一元多项式加减乘除源代码(国外英文资料).docVIP

  • 12
  • 0
  • 约1.22万字
  • 约 31页
  • 2017-06-05 发布于河南
  • 举报

一元多项式加减乘除源代码(国外英文资料).doc

一元多项式加减乘除源代码(国外英文资料)

一元多项式加减乘除源代码 / / Polynomial_list / / function: enter two polynomials (dont be in the order of the ascending power, the program will automatically merge the same class and sort), add and subtract and multiply and divide # include stdio, h # include stdlib. H H # include math.h / / node definition Typedef struct PolyNode { Int exp. / / index Float coef. / / coefficient PolyNode * next; } PolyNode, * PolyList; / / function declaration PolyList CreatePolyList (); / / create polynomial lists and return headers Void DisplayPolyList (PolyList Poly real); / / display polynomial Void DestroyPolyList PolyList (L); / / release the storage space for the list Void MergePoly (PolyList Poly real); / / the polynomial and the same class Void SortPoly (PolyList Poly real); / / put the polynomial in ascending order PolyList PolyA, PolyList PolyB. / / polynomials, return and polynomial chain headers PolyList polya, PolyList polyb. / / polynomials, the return differential polynomial chain header PolyList PolyA, PolyList PolyB. / / polynomials, which are returned by PolyC PolyList PolyDivide. / / polynomials, the results are stored in PolyC, separated by nodes with coefficients of 0 / / function implementation / / create polynomial lists and return headers PolyList CreatePolyList () { PolyNode * s, * rear, * head. Int e; / / index Float c; / / coefficient Int n = 1; / / counter PolyNode *) malloc (PolyNode); Rear = head; / / the coefficient and exponent of the input polynomial, if the input coefficient is 0 Printf ( please enter the coefficients and indexes of the % d item in the polynomial (separated by commas) : , +) Scanf ( % f, % d, ). While (fabs (c) 1e-6) PolyNode *) malloc (PolyNode); S- exp = e; S-, coef = c; Rear - next = s; Rear = s; Printf ( please enter the coefficients and indexes of the % d term of the polynomial, ); Scanf ( % f, % d, ). } Rear - next = NULL; Return the head; } / / calculate two polynomials (not in order), and result in the list PolyC, and return P

文档评论(0)

1亿VIP精品文档

相关文档