Website Summary Files Commits Branches @commit @diff @stats
path: root / Week05 / Exercise08.cpp
blob: 47fa3764ddff517b930ad984e4db7757bca76aff (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
25
26
27
28
29
30
31
32
#include <iostream>

int main() {
    const unsigned int SIZE = 10;

    /* Става по-елегантно ако използваме един масив */
    double row1[SIZE], row2[SIZE];
    for (int i = 0; i < SIZE; i++) {
        std::cin >> row1[i];
    }
    for (int i = 0; i < SIZE; i++) {
        std::cin >> row2[i];
    }

    char operation;
    std::cin >> operation;

    double result;
    for (int i = 0; i < SIZE; i++) {
        switch (operation) {
            case '+': result = row1[i] + row2[i]; break;
            case '-': result = row1[i] - row2[i]; break;
            case '*': result = row1[i] * row2[i]; break;
            case '/': result = row1[i] / row2[i]; break;
        }
        std::cout << result << ' ';
    }

    std::cout << std::endl;

    return 0;
}