int operation(int op, int n1, int n2) {
switch( op )
{
case 1:
return subtraction(n1, n2);
case 2:
return multiplication(n1, n2);
default:
// default case, when the op value is neither 1 or 2
cout << "Error! << endl;
return 0;
}
}
@Edit: Added default case as suggested below. Also, I think that you should make your variables name’s more descriptive.
6
solved calling method in c++ [closed]