求助 c语言中编写计算器问题用getchar
#include<stdio.h>#include<iostream>
void main()
{
int a,b,sum;
char c;
printf("please input the two number:");
scanf_s("%d,%d",&a,&b);
printf("please input you want the oreap:");
c=getchar();
if(c=='+')
{
sum=a+b;
printf("the result=%d",sum);
}
if(c=='-')
{
sum=a-b;
printf("the result=%d",sum);
}
if(c=='*')
{
sum=a*b;
printf("the result=%d",sum);
}
if(c=='/')
{
sum=a/b;
printf("the result=%d",sum);
}
system("pause");
}
这是我的代码,但为什么我到getchar后的代码运行不了,可以详细的说明用getchar来编写四则运算的计算器