输入格式:
一行中给出一个算式,形如A+B或A-B,A、B为整数。运算符前后可能包含若干空格。
输出格式:
在一行中输出算式结果,如果算式不是加法和减法,输出:error!。
贴出你的代码来
int main()
{
int a,b;
char s[10];
scanf("%d%s%d",&a,s,&b);
if(s[0] == '+')
printf("%d",a+b);
else if(s[0] == '-')
printf("%d",a-b);
else
printf("error!");
system("pause");
}