#include<stdio.h>
#include<stdlib.h>
typedef struct polynode
{
int coef;
int exp;
struct polynode * next;
}PNode;
PNode * Creat_Linkst (int n)
{
PNode * head, * p, * s;
int i;
head=(PNode *)malloc(sizeof(PNode));
head->next=NULL;
p=head;
printf("enter coef:\n");
for(i=1;i<=n;++i)
{
s=(PNode *)malloc(sizeof(PNode));
scanf("%d,%d",&s->coef,&s->exp);
s->next=s;
p=s;
}
return (head);
}
void Print_Linkst(PNode *H)
{
PNode * p;
p=H->next;
while(p->next)
{
printf("%dx^%d+",p->coef,p->exp);
p=p->next;
}
if(p->exp)
printf("%dx^%d\n",p->coef,p->exp);
else
printf("%d\n",p->coef);
}
main()
{
PNode *pa;
int num;
printf("enter num:");
scanf("%d",&num);
pa=Creat_Linkst(num);
printf("A(x)=");
Print_Linkst(pa);
getchar();
}