a与b的运算(a和b均为十以内的整数,计算符号仅包括+-/)
示例:
输入:56
输出:30
题目啥意思?
输入怎么得到对应的输出的。
#include <iostream>
using namespace std;
int main()
{
int a,b;
char op;
cin >>a>>op>>b;
if(op=='+')
cout << a+b<<endl;
else if(op=='-')
cout << a-b<<endl;
else if(op=='*')
cout << a*b<<endl;
else if(op=='/')
{
if(b!=0)
cout << a/b<<endl;
else
cout <<"除数不能为0"<<endl;
}else
cout << "不识别的运算符"<<endl;
return 0;
}