-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5.12.cpp
More file actions
54 lines (52 loc) · 1.07 KB
/
5.12.cpp
File metadata and controls
54 lines (52 loc) · 1.07 KB
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
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <cctype> // tolower
using std::cout;
using std::cin;
using std::endl;
int main() {
unsigned aCnt = 0, eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0;
unsigned ffCnt = 0, flCnt = 0, fiCnt = 0;
char ch, prevCh;
while (cin >> ch) {
switch (ch) {
case 'a': case 'A':
++aCnt;
break;
case 'e': case 'E':
++eCnt;
break;
case 'i':
if (prevCh == 'f')
++fiCnt;
case 'I':
++iCnt;
break;
case 'o': case 'O':
++oCnt;
break;
case 'u': case 'U':
++uCnt;
break;
case 'f':
if (prevCh == 'f')
++ffCnt;
break;
case 'l':
if (prevCh == 'f')
++flCnt;
break;
default:
break;
}
prevCh = ch;
}
cout << "Number of vowel a: " << aCnt << '\n'
<< "Number of vowel e: " << eCnt << '\n'
<< "Number of vowel i: " << iCnt << '\n'
<< "Number of vowel o: " << oCnt << '\n'
<< "Number of vowel u: " << uCnt << '\n'
<< "Number of sequence ff: " << ffCnt << '\n'
<< "Number of sequence fl: " << flCnt << '\n'
<< "Number of sequence fi: " << fiCnt << endl;
return 0;
}