#include<iostream>
int main()
{
while (true) {
char op;
std::cout << "Enter equation to be performed --> ";
std::cin >> op;
if (op == 'N')
break;
std::cin.unget();
int left_int, right_int, result;
std::cin >> left_int >> op>> right_int;
switch (op)
{
case '+':
result = left_int + right_int;
break;
case '-':
result = left_int - right_int;
break;
case '*':
result = left_int * right_int;
break;
case '/':
result = left_int / right_int;
break;
case '%':
result = left_int % right_int;
break;
default:
std::cout << "Unsuppoted operand: " << op;
break;
}
std::cout << result << std::endl;
}
}
I2luY2x1ZGU8aW9zdHJlYW0+CgoKaW50IG1haW4oKQp7CiAgICB3aGlsZSAodHJ1ZSkgewogICAgICAgIGNoYXIgb3A7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJFbnRlciBlcXVhdGlvbiB0byBiZSBwZXJmb3JtZWQgLS0+ICI7CiAgICAgICAgc3RkOjpjaW4gPj4gb3A7CiAgICAgICAgaWYgKG9wID09ICdOJykKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgc3RkOjpjaW4udW5nZXQoKTsKICAgICAgICBpbnQgbGVmdF9pbnQsIHJpZ2h0X2ludCwgcmVzdWx0OwogICAgICAgIHN0ZDo6Y2luID4+IGxlZnRfaW50ID4+IG9wPj4gcmlnaHRfaW50OwogICAgICAgIHN3aXRjaCAob3ApCiAgICAgICAgewogICAgICAgICAgY2FzZSAnKyc6CiAgICAgICAgICAgIHJlc3VsdCA9IGxlZnRfaW50ICsgcmlnaHRfaW50OwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXN1bHQgPSBsZWZ0X2ludCAtIHJpZ2h0X2ludDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICcqJzoKICAgICAgICAgICAgcmVzdWx0ID0gbGVmdF9pbnQgKiByaWdodF9pbnQ7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAnLyc6CiAgICAgICAgICAgIHJlc3VsdCA9IGxlZnRfaW50IC8gcmlnaHRfaW50OwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgJyUnOgogICAgICAgICAgICByZXN1bHQgPSBsZWZ0X2ludCAlIHJpZ2h0X2ludDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgIlVuc3VwcG90ZWQgb3BlcmFuZDogIiA8PCBvcDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgICAgIHN0ZDo6Y291dCA8PCByZXN1bHQgPDwgc3RkOjplbmRsOwogICAgfQp9Cg==