RE求助
查看原帖
RE求助
958260
man123楼主2023/5/14 15:23
#include<iomanip>
#include <cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    int a,b;
    string c;
    cin>>a>>b>>c;
    if(c=="+"){
    	cout<<a+b;
	}
	else if(c=="-"){
		cout<<a-b;
	}
	else if(c=="/"){
		cout<<a/b;
	}
	else if(c=="*"){
		cout<<a*b;
	}
	else if(b==0&&c=="/"){
		cout<<"Divided by zero!";
	}
	else if(c!="+"&&c!="-"&&c!="*"&&c!="/"){
		cout<<"Invalid operator!";
	}
	return 0;
}
2023/5/14 15:23
加载中...