int main()
{
读入多项式
polynomial readpoly()
{
polynomial p,rear,t;
int c,e,n;
scanf("%d,&n);
p=(polynomial)malloc(sizeof(struct polynode));
p->link=null;
rear=p;
while(n--)
{
scanf("%d %d",&c,&e);
attach(c,e,&rear);
}
t=p;
p=p->link;
free(t);
return p;
}
如何让两个多项式相加
ploynomail polyadd(polynomial p1,polynomial p2)
{
polynomial front,rear,temp;
int sum;
rear=(polynomial)malloc(sizeof(struct polynode));
front=rear;
while(p1&&p2)
{
switch(compare(p1->expon,p2->expon)
{
case 1:
attach(p1->coef,p1->expon,&rear);
p1=p1->link;
break;
case -1:
attach(p2->coef,p2->expon,&rear);
p2=p2->link;
break;
case 0;
sum=p1->coef+p2->coef;
attach(sum,p1->expon,&rear);
p1=p1->link;
p2=p2->link;
break;
}
fo