这段程序什么意思啊!C.求大神指导!while(pa&&pb) { CreateItem(s); i=ItemComp(*pa,*pb); if(i==0){ s->coef=pa->coef+pb->coef; s->expn=pa->expn; if(s->coef){last->next=s;s->next=NULL;last=s;} pa=pa->next; pb=pb->next;

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 08:25:04
这段程序什么意思啊!C.求大神指导!while(pa&&pb)  {  CreateItem(s);  i=ItemComp(*pa,*pb);  if(i==0){  s->coef=pa->coef+pb->coef;  s->expn=pa->expn;  if(s->coef){last->next=s;s->next=NULL;last=s;}      pa=pa->next;  pb=pb->next;
xU[OA~l_ P K|jbkה% iE, Tj[[Em&(A.c:_첰 Dt^v9|3g(bv;ɐZ |F9j쓝Iz ;.l5<}5֛$q|m],Pqr<&ѫ'؜(mNr{I.v|fm&HrQp>d| м{H &ttՋO}zЙ87P!*(nmvߓkdH_B^eJߞG\Owގ6++ldF"&ݩu $5M=UW?AVf zH}V^ǵE¾^4I~W3^b-:ǂx*@!7ٻ$oB7y%Xyػ Z@)Znx /6INPgmI~̣;h  BRvE wa1̮̣ sNϯM%'0X3`KyQؓ_z:B@ iA >/#}tπ2ffC(Iϫ`_{x,n4x>;Ժש,\T+1|!<ɗl/ &') E W

这段程序什么意思啊!C.求大神指导!while(pa&&pb) { CreateItem(s); i=ItemComp(*pa,*pb); if(i==0){ s->coef=pa->coef+pb->coef; s->expn=pa->expn; if(s->coef){last->next=s;s->next=NULL;last=s;} pa=pa->next; pb=pb->next;
这段程序什么意思啊!C.求大神指导!
while(pa&&pb)
{
 CreateItem(s);
 i=ItemComp(*pa,*pb);
 if(i==0){
 s->coef=pa->coef+pb->coef;
 s->expn=pa->expn;
 if(s->coef){last->next=s;s->next=NULL;last=s;}
 pa=pa->next;
 pb=pb->next;
 }
 else if(icoef=pa->coef;s->expn=pa->expn;
 last->next=s; s->next=NULL;
 last=s;
 pa=pa->next;}
 else{ s->coef=pb->coef;s->expn=pb->expn;
 last->next=s; s->next=NULL;
 last=s;
 pb=pb->next;
 }
}
s0=pa?pa:pb;
while(s0){
 CreateItem(s);
 *s=*s0;
 last->next=s;
 s->next=NULL;
 last=s;
 s0=s0->next;
}

这段程序什么意思啊!C.求大神指导!while(pa&&pb) { CreateItem(s); i=ItemComp(*pa,*pb); if(i==0){ s->coef=pa->coef+pb->coef; s->expn=pa->expn; if(s->coef){last->next=s;s->next=NULL;last=s;} pa=pa->next; pb=pb->next;
while(pa&&pb) //判断pa和pb是否为空
{
 CreateItem(s); //调用createitem函数,s为形参
 i=ItemComp(*pa,*pb); //返回值作为一个开关使用
 if(i==0){ //等于0 两个元素都向下继续
 s->coef=pa->coef+pb->coef; 用pa、pb指向的结构体属性coed的和赋给s指向的coef
 s->expn=pa->expn; //pa指向的expn赋值给 s指向的
 if(s->coef){last->next=s;s->next=NULL;last=s;} 判断s指向的结构体下的属性coef
然后执行赋值
 pa=pa->next; // 然后指向下一个元素
 pb=pb->next;
 }
//以上为链表指向
 else if(icoef=pa->coef;s->expn=pa->expn; //小于0 表示pa节点向下走一个元素
 last->next=s; s->next=NULL;
 last=s;
 pa=pa->next;}
 else{ s->coef=pb->coef;s->expn=pb->expn; //大于0 标志pb节点向下走一个元素
 last->next=s; s->next=NULL;
 last=s;
 pb=pb->next;
 }
}
s0=pa?pa:pb; //一下是把最后一个元素赋给链表结尾,结束.
while(s0){
 CreateItem(s);
 *s=*s0;
 last->next=s;
 s->next=NULL;
 last=s;
 s0=s0->next;
}
//这个貌似是数据结构里的一个例子吧,看着熟悉.