#include <stdio.h>
#include <stdlib.h>
int main()
{
int x,y;
char ch;
while(scanf("%d",&x)==1)
{
ch = getchar();
while(ch==' '){ ch = getchar();}
scanf("%d",&y);
switch(ch)
{
case '+':printf("%d
",x+y);break;
case '-':printf("%d
",x-y);break;
case '*':printf("%d
",x*y);break;
default : break;
}
}
return 0;
}
-
在按回车前,getchar在等待,getchar()函数在按下回车后从输入缓冲区读取1个字符