📅  最后修改于: 2022-03-11 14:52:10.305000             🧑  作者: Mango
int Compute(char c, int a, int b)
{
switch (c) {
case '+': return a+b;
case '-': return a-b;
case '*': return a*b;
case '/': return a/b;
default: throw std::runtime_error("No such operator");
}
}