{
int ch =getchar();
if ('Y' == ch)
{
printf("确认成功");
}
else ('N' == ch) /*这里为什么要加“; ”?*/
{
printf("确认失败");
}
return 0;
}
如图,为什么else后面要加“;”?
else改为else if,或者去掉 else后面的('N' == ch ),因为else 分支后面不需要加条件,加了就会报错,如果要加条件可以把else 改为else if。