C语言编程提示 illegal else without matching if
#include<stdio.h>intmain(){inta,b,sum;scanf("%d,%d",&a,&b);if(a>0&&b>0)sum=a+b;printf...
#include<stdio.h>
int main()
{
int a,b,sum;
scanf("%d,%d",&a,&b);
if(a>0&&b>0)
sum=a+b;
printf("sum is %d\n",sum);
else
printf("error\n");
return 0;
}
Compiling...
ta.cpp
D:\C语言\ta.cpp(9) : error C2181: illegal else without matching if
执行 cl.exe 时出错.
ta.obj - 1 error(s), 0 warning(s) 展开
int main()
{
int a,b,sum;
scanf("%d,%d",&a,&b);
if(a>0&&b>0)
sum=a+b;
printf("sum is %d\n",sum);
else
printf("error\n");
return 0;
}
Compiling...
ta.cpp
D:\C语言\ta.cpp(9) : error C2181: illegal else without matching if
执行 cl.exe 时出错.
ta.obj - 1 error(s), 0 warning(s) 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询