Website Summary Files Commits Branches @commit @diff @stats
path: root / Week04 / Exercise12.cpp
blob: 9b7d311d297ff85e346ea2c366d07f3f1e0fc01a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

int main() {
    char operation;
    std::cin >> operation;

    while (operation != '.') {
        int a, b;
        std::cin >> a >> b;

        int result = 0;
        switch (operation) {
            case '+': result = a + b; break;
            case '-': result = a - b; break;
            case '*': result = a * b; break;
            case '/': result = a / b; break;
        }
        std::cout << result << std::endl;

        std::cin >> operation;
    }

    return 0;
}