Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
46184 zhangyanshuo 简单计算器 C++ 通过 1 MS 256 KB 474 2024-04-26 21:12:48

Tests(1/1):


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


测评信息: