-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathalphabatecleaner.cpp
More file actions
39 lines (34 loc) · 1.02 KB
/
alphabatecleaner.cpp
File metadata and controls
39 lines (34 loc) · 1.02 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
#include <iostream>
using namespace std;
int main() {
string line;
string temp = "";
cout << "Enter a string: ";
getline(cin, line);
for (int i = 0; i < line.size(); ++i) {
if ((line[i] >= 'a' && line[i] <= 'z') || (line[i] >= 'A' && line[i] <= 'Z')) {
temp = temp + line[i];
}
}
line = temp;
cout << "Output String: " << line;
unsigned aCnt = 0, eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0;
char ch;
while (cin >> ch) {
if (ch == 'a')
++aCnt;
else if (ch == 'e')
++eCnt;
else if (ch == 'i')
++iCnt;
else if (ch == 'o')
++oCnt;
else if (ch == 'u')
++uCnt;
}
cout << "Number of vowel a: \t" << aCnt << '\n' << "Number of vowel e: \t"
<< eCnt << '\n' << "Number of vowel i: \t" << iCnt << '\n'
<< "Number of vowel o: \t" << oCnt << '\n' << "Number of vowel u: \t"
<< uCnt << endl;
return 0;
}