summaryrefslogtreecommitdiff
path: root/Year_1/Programming_1/ex2_18_02_19.cc
blob: 8195fb979e17fe4d06d20235e15653c960f0c386 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
#include<cctype>

using namespace std;

short func(string (*M)[4], unsigned short k, unsigned short s) {
    short counter{};

    for(int i = 0; i < 4; ++i) {
        short _rowcounter{};
        for(int j = 0; j < 3; ++j) {
            short _vocals{};
            for(char& c : M[j][i]) {
                switch(tolower(c)) {
                    case 'a': case 'e': case 'i': case 'o': case 'u':
                        ++_vocals;
                        break;
                    default: break;
                }
            }

            if(_vocals < s) ++_rowcounter;
        }

        if(_rowcounter >= k) ++counter;
    }

    return counter;
}


int main() {
    string M[3][4] = {
        {"HEI", "we", "ciao", "com'è?"},
        {"HEI", "we", "ciao", "com'è?"},
        {"HEI", "we", "ciao", "com'è?"},
    };
    
    cout << func(&M[0], 2, 3);


    return 0;
}