【发布时间】:2014-11-15 12:24:31
【问题描述】:
if (operation = '+' || operation = '-' || operation = '*' || operation = '/' || operation = '%')//error line
{
printf("Enter the first operand:\t\t");
getchar();
scanf("%d", &num1);
printf("Enter the second operand:\t\t");
getchar();
scanf("%d", &num2);
}
它给出一个错误说:
Error: expresion must be a modifiable value
它给了我关于 if 行的错误,除了那个说的那个之外的所有论点
operation = '%'
有什么问题?? 谢谢你们:)
【问题讨论】:
-
=是赋值,==比较。 -
你在
if声明中一定是指==? -
(不相关)您不应该将
getchar()的结果存储在某处吗? -
@Jongware ,我认为他们被安排吃
\n被scanfs 遗漏的@s
标签: c if-statement lvalue