| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 47108 | 杨中琦 | 简单计算器 | C++ | Accepted | 100 | 0 MS | 252 KB | 365 | 2022-07-14 11:17:04 |
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; char c; cin>>a>>b>>c; if(c!='+'&&c!='-'&&c!='*'&&c!='/'){ cout<<"Invalid operator!"; }else{ if(c=='/'&&b==0){ cout<<"Divided by zero!"; }else{ if(c=='+') cout<<a+b; if(c=='-') cout<<a-b; if(c=='*') cout<<a*b; if(c=='/') cout<<a*1.0/b; } } return 0; }