小白求解!!!
#include "stdio.h"
void main()
{
int n1,n2;
char a;
printf("请按顺序输入两个数字和运算符\n");
scanf("%f,%f",&n1,&n2);
switch(a)
{
case'+':result=n1+n2;
break;
case'-':result=n1-n2;
break;
case'*':result=n1*n2;
break;
case'/':if(n2==0)
printf("输入的数字非法,请从新输入");
else
result=n1/n2;
break;
default:printf("运算符非法");
}
printf("%.2c",result);
}
上面是代码。一直出现问题。各位大神看看,求解!