谭博文


私信TA

用户名:asdrehuk

访问量:707

签 名:

我们都是文明人

等  级
排  名 14113
经  验 840
参赛次数 0
文章发表 2
年  龄 11
在职情况 学生
学  校 麓山外国语
专  业 computer(IT)

  自我简介:

解题思路:
定义二个int类型,一个char类型变量

用if函数

即可解决此题
注意事项:



参考代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	char c;
	cin>>a>>b>>c;
	if(c=='+'){
		cout<<a+b<<endl;
	}
	if(c=='-'){
		cout<<a-b<<endl;
	}
	if(c=='*'){
		cout<<a*b<<endl;
	}
	if(c=='/'){
		cout<<a/b<<endl;
	}
	if(c=='%'){
		cout<<a%b<<endl;
	}
	return 0;
}


 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区