提交时间:2024-01-23 16:56:23

运行 ID: 125434

#include<bits/stdc++.h> using namespace std; int main() { long long a,b; char s; double d; cin>>a>>s>>b; if(s=='+') { cout<<a+b; return 0; } if(s=='-') { cout<<a-b; return 0; } if(s=='*') { cout<<a*b; return 0; } if(s=='/'&&b!=0) { d=a/b; cout<<d; return 0; } if(s=='/'&&b==0) { cout<<"Divided by zero!"; return 0; } cout<<"Invalid operator!"; return 0; }