Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
807 B
3
Indexable
Never
#include <iostream>
using namespace std;
int main()
{
    char a = 0;
    int b;
    char c = 0;
    int r = 0;
    while (a != 'x')
    {
        cin >> a;
        if (a == '@')
        {
            a = r;
        }
        if (a == 'x')
        {
            return 0;
        }
        cin >> c >> b;
        switch (c)
        {
        case '*':
            r = (a - '0') * b;
            cout << r << "\n";
            break;
        case '/':
            r = (a - '0') / b;
            cout << r << "\n";
            break;
        case '-':
            r = (a - '0') - b;
            cout << r << "\n";
            break;
        case '+':
            r = (a - '0') + b;
            cout << r << "\n";
            break;
        }
    }
    return 0;
}