从哪来的wa
查看原帖
从哪来的wa
1058586
hjk20120612楼主2023/12/23 10:58
#include<bits/stdc++.h>
using namespace std;
string a;
int str_get_int(string x){
	int a=(x[0]-48)*10+(x[1]-48),b=(x[3]-48)*10+(x[4]-48);
	if(x[2]=='+'){
		return a+b;
	}
	else if(x[2]=='-'){
		return a-b;
	}
	else if(x[2]=='*'){
		return a*b;
	}
	else if(x[2]=='/'){
		return a/b;
	}
	else{
		if(x[2]=='%'){
			return a%b;
		}
	}
}
int main(){
	cin>>a;
	cout<<str_get_int(a);
	return 0;
}
2023/12/23 10:58
加载中...