程序改错,请问怎么改?#includeint main(void){char sign;int x,y;printf("输入x运算符y:");scanf("%d%c%d",&x,& sign,&y);if(sign='*')printf("%d*%d=%d\n",x,y,x*y);else if(sign='/')printf("%d/%d=%d\n",x,y,x/y);else if(sign='%')printf("%dMod%d=%d
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 23:02:26
程序改错,请问怎么改?#includeint main(void){char sign;int x,y;printf("输入x运算符y:");scanf("%d%c%d",&x,& sign,&y);if(sign='*')printf("%d*%d=%d\n",x,y,x*y);else if(sign='/')printf("%d/%d=%d\n",x,y,x/y);else if(sign='%')printf("%dMod%d=%d
程序改错,请问怎么改?
#include
int main(void)
{
char sign;
int x,y;
printf("输入x运算符y:");
scanf("%d%c%d",&x,& sign,&y);
if(sign='*')
printf("%d*%d=%d\n",x,y,x*y);
else if(sign='/')
printf("%d/%d=%d\n",x,y,x/y);
else if(sign='%')
printf("%dMod%d=%d\n",x,y,x%y);
else
printf("运算符输入错误!\n");
return 0;
}
哪里出错了?
程序改错,请问怎么改?#includeint main(void){char sign;int x,y;printf("输入x运算符y:");scanf("%d%c%d",&x,& sign,&y);if(sign='*')printf("%d*%d=%d\n",x,y,x*y);else if(sign='/')printf("%d/%d=%d\n",x,y,x/y);else if(sign='%')printf("%dMod%d=%d
判断语句是两个等号哟
#include
int main(void)
{
char sign;
int x,y;
printf("输入x运算符y:");
scanf("%d%c%d",&x,& sign,&y);
if(sign=='*')
printf("%d*%d=%d\n",x,y,x*y);
else if(sign=='/')
printf("%d/%d=%d\n",x,y,x/y);
else if(sign=='%')
printf("%dMod%d=%d\n",x,y,x%y);
else
printf("运算符输入错误!\n");
return 0;
}