大师们,帮我看看我写的程序错在哪啊?
#include<stdio.h>void main()
{
int num1,num2,result;
char op;
printf("请输入num1,num2的值:");
scanf("%d,%d",&num1,&num2);
printf("请输入运算符,只能在(+、-、%、*、/)中选择:\n");
scanf("%c",&op);
switch(op)
{
case'+':
result=num1+num2;
break;
case'-':
result=num1-num2;
break;
case'*':
result=num1*num2;
break;
case'%':
result=num1%num2;
break;
case'/':
if(num2==0)
{
printf("此输入有误!\n");
}
else
{
result=num1/num2;
break;
}
default:
{
printf("operator is out of range\n");
break;
}
}
printf("结果是%d\n",result);
}