Files
OI-source/history_source/信息学奥赛一本通/1.3.9.cpp
2023-08-03 09:22:52 +08:00

22 lines
373 B
C++

#include<cstdio>
using namespace std;
int main()
{
int a,b;
char f;
scanf("%d%c%d",&a,&f,&b);
switch(f)
{
case '+':printf("%d\n",a+b);break;
case '-':printf("%d\n",a-b);break;
case '*':printf("%d\n",a*b);break;
case '/':
if(b==0) printf("Divided by zero!\n");
else printf("%d\n",a/b);
break;
default:printf("Invalid operator!\n");j
}
return 0;
}