我是编程新手。我正在使用 Pelles C ide 编译 C,它昨天还在工作,但现在出现了这个错误。
这是该项目的代码:
#include <stdio.h>
int main(void)
{
double operand1;
double result;
char operator;
double operand2;
printf("This is a calculator");
printf("Type a simple expression...");
scanf("%lf %s %lf", &operand1, &operator, &operand2);
if(operator == '+')
{
result = operand1 + operand2;
}
else if (operator == '-')
{
result = operand1 + operand2;
}
else if (operator == '*')
{
result = operand1 * operand2;
}
else if (operator == '/')
{
result = operand1 / operand2;
}
else
{
printf("Wrong input. Exiting.");
return 1;
}
printf("The answer is: %lf ", result);
return 0;
}
这个错误的原因是什么?
还有这个,不记得以前有这个了