| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 51611 | 张思存 | 简单计算器 | C++ | Accepted | 0 MS | 244 KB | 538 | 2024-09-22 21:53:52 |
#include <bits/stdc++.h> using namespace std; int main() { int a, b; char ch; cin >> a >> b >> ch; if(ch == '+'){ cout << a+b; }else{ if(ch == '-'){ cout << a-b; }else{ if(ch == '*'){ cout << a*b; }else{ if(ch == '/'){ if(b == 0){ cout << "Divided by zero!"; }else{ cout << a/b;} }else{ cout << "Invalid operator!"; } } } } return 0; }