아주 쉬운 문제. 각 연산하는 수를 받고 연산자를 받은 뒤 연산자의 종류에 따라서 조건문으로 만들어서 계산만 하면 된다.
#include <iostream>
using namespace std;
int x, y;
char a;
void cal() {
if(a == '+') {
cout << x << " + " << y << " = " << x + y << endl;
} else if(a == '-') {
cout << x << " - " << y << " = " << x - y << endl;
} else if(a == '*') {
cout << x << " * " << y << " = " << x * y << endl;
} else {
cout << x << " / " << y << " = " << x / y << endl;
}
}
int main() {
// 여기에 코드를 작성해주세요.
cin >> x >> a >> y;
cal();
return 0;
}