tyt_ @ 2024-12-17 19:47:07
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,m;
char x;
cin>>n>>m>>x;
if(x=='+') cout<<n+m;
else if(x=='-') cout<<n-m;
else if(x=='*') cout<<n*m;
else if(x=='/'){
if(n/m==0) cout<<"Divided by zero!";
else cout<<n/m;
}
else cout<<"Invalid operator!";
}
by lfk114514 @ 2024-12-17 19:53:31
if(n/m==0)改为if(m==0)
by tyt_ @ 2024-12-17 19:57:03
@lfk114514谢谢,已A