生成链表的程序,求改错
typedef struct Polynomial{float coef; //系数
int expn; //指数
struct Polynomial *next;
}*Polyn,Polynomial;
int m=0,n1=0,n2=0,i=0,a=0,k=0,b=0;
double xishu;
int zhishu;
i=shuru1.GetLength();
CString hr[10],hr1;
Polyn pa,pa1;
Polyn q1,q2;
for(;a==0&&b<10;)
{
if(shuru1.GetAt(0)=='+')
{m=0;
shuru1.Delete(0,1);}
if(shuru1.GetAt(0)=='-')
{m=1;
shuru1.Delete(0,1);}
n1=shuru1.Find('+');
n2=shuru1.Find('-');
if(n1>0&&n2==-1)
k=n1;
if(n2>0&&n1==-1)
k=n2;
if(n1>0&&n2>0)
{if(n2>n1)
k=n1;
if(n1>n2)
k=n2;
}
if(n1==-1&&n2==-1)
{k=i;
a=-1;}
hr[b]=shuru1.Mid(0,k);
hr1=hr[b];
b++;
shuru1.Delete(0,k);
}
pa=(Polyn)malloc(sizeof(struct Polynomial));
pa->next=NULL;
for(;b>0;)
{pa1=(Polyn)malloc(sizeof(struct Polynomial));
if(hr[b].Find('x')==-1)
{pa1->coef=_wtof(hr[b]);
pa1->expn=0;}
else{
if(hr[b].Find('x')==0)
pa1->coef=1;
else
pa1->coef=_wtof(hr[b].Mid(0,(hr[b].Find('x'))));}
if(m==1)
pa1->coef=0-pa1->coef;
hr[b].Delete(0,(hr[b].Find('x')));
if(hr[b].Find('^')==-1)
pa1->expn=1;
else
{hr[b].Delete(0,2);
pa1->expn=_wtof(hr[b].Mid(0,hr[b].GetLength()));}
} //杯具了指数不能为负
if(pa1->coef==0) free(pa1); //系数为0的话释放结点
else
{
Polyn q1,q2;
q1=pa;
q2=pa->next;
while(q2&& pa1->expn < q2->expn)
{ //查找插入位置
q1=q2;
q2=q2->next;
}
if(q2&& pa1->expn == q2->expn)
{ //将指数相同相合并
q2->coef += pa1->coef;
free(pa1);
if(!q2->coef)
{ //系数为0的话释放结点
q1->next=q2->next;
free(q2);
}
}
else
{ //指数为新时将结点插入
pa1->next=q2;
q1->next=pa1;
}
}
mfc写的提取指数和系数并生成指数递减的一元多项式的链表的部分代码,求帮改错