#include<bits/stdc++.h> using namespace std; int main() { double a,b,s; char c; cin>>a>>b>>c; if ((c=='/')&&(b==0)) { cout<<"Divided by zero!"<<endl; } else if((c=='+')||(c=='-')||(c=='*')||(c=='/')) { switch(c) { case '+': s=a+b; break; case '-': s=a-b; break; case '*': s=a*b; break; default : s=a/b; } cout<<s<<endl; } else { cout<<"Invalid operator!"<<endl; } return 0; }
信息学奥赛一本通2058
最新推荐文章于 2024-07-19 19:23:17 发布