Website Summary Files Commits Branches @commit @diff @stats
path: root / pract_SI / Pract. 04 / Solutions / task9.cpp
blob: 0356de8780de9c091bb9126ff8dafc5f577a2536 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int calculate(int a, int b, char action = '+')
{
	switch (action)
	{
	case '+': return a + b;
	
	case '-': return a - b;
	
	case '*': return a * b;
	
	case '/': return a / b;
	
	case '%': return a % b;
	
	default: return -1;
	}
}