vc6.0提示error C2143: syntax error : missing ')' before ';'
我的源代码:voidDisplayPolyList(PolyListPoly){//显示多项式if(Poly==NULL){printf("\n");return;}Po...
我的源代码:
void DisplayPolyList(PolyList Poly){
//显示多项式
if(Poly == NULL) {
printf("\n");
return;
}
PolyNode *p=Poly->next ;
if(p == NULL){printf("0\n"); return;} //如果链表为空提前退出
while(p!=NULL)
{
if(fabs(p->coef)>1e-6) //p的系数不为0
{
if(p->pre=Poly) printf("%f*x^%d" , p->coef , p->exp);
else{
if(p->coef>1e-6) printf("+ %f*x^%d" , p->coef , p->exp);
else printf("%f*x^%d" , p->coef , p->exp);
//当p->coef为负时直接显示即可
}//else
}//if(fabs(p->coef)>1e-6)
p = p->next ;
}// while(p!=NULL)
printf("\n");
}//DisplayPolyList
出现的错误提示为:
yiyuanx.h(5) : warning C4005: 'NULL' : macro redefinition
d:\program files\microsoft visual studio\vc98\include\stdio.h(210) : see previous definition of 'NULL'
yiyuanx.cpp(6) : error C2143: syntax error : missing ')' before ';'
yiyuanx.cpp(6) : error C2059: syntax error : ')'
yiyuanx.cpp(6) : warning C4390: ';' : empty controlled statement found; is this the intent?
yiyuanx.cpp(11) : error C2143: syntax error : missing ')' before ';'
yiyuanx.cpp(11) : error C2059: syntax error : ')'
yiyuanx.cpp(11) : warning C4390: ';' : empty controlled statement found; is this the intent?
yiyuanx.cpp(12) : error C2143: syntax error : missing ')' before ';'
yiyuanx.cpp(12) : error C2059: syntax error : ')'
谁能帮忙看看到底是哪里出了问题?
第一行的标号是yiyuanx.cpp(4),另外第一个警告不是这段里边的。 展开
void DisplayPolyList(PolyList Poly){
//显示多项式
if(Poly == NULL) {
printf("\n");
return;
}
PolyNode *p=Poly->next ;
if(p == NULL){printf("0\n"); return;} //如果链表为空提前退出
while(p!=NULL)
{
if(fabs(p->coef)>1e-6) //p的系数不为0
{
if(p->pre=Poly) printf("%f*x^%d" , p->coef , p->exp);
else{
if(p->coef>1e-6) printf("+ %f*x^%d" , p->coef , p->exp);
else printf("%f*x^%d" , p->coef , p->exp);
//当p->coef为负时直接显示即可
}//else
}//if(fabs(p->coef)>1e-6)
p = p->next ;
}// while(p!=NULL)
printf("\n");
}//DisplayPolyList
出现的错误提示为:
yiyuanx.h(5) : warning C4005: 'NULL' : macro redefinition
d:\program files\microsoft visual studio\vc98\include\stdio.h(210) : see previous definition of 'NULL'
yiyuanx.cpp(6) : error C2143: syntax error : missing ')' before ';'
yiyuanx.cpp(6) : error C2059: syntax error : ')'
yiyuanx.cpp(6) : warning C4390: ';' : empty controlled statement found; is this the intent?
yiyuanx.cpp(11) : error C2143: syntax error : missing ')' before ';'
yiyuanx.cpp(11) : error C2059: syntax error : ')'
yiyuanx.cpp(11) : warning C4390: ';' : empty controlled statement found; is this the intent?
yiyuanx.cpp(12) : error C2143: syntax error : missing ')' before ';'
yiyuanx.cpp(12) : error C2059: syntax error : ')'
谁能帮忙看看到底是哪里出了问题?
第一行的标号是yiyuanx.cpp(4),另外第一个警告不是这段里边的。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询