We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7aacfc7 + e5c1ce9 commit 4b7276fCopy full SHA for 4b7276f
algorithms/strings/vowel_counter.cpp
@@ -0,0 +1,28 @@
1
+#include <iostream>
2
+using namespace std;
3
+
4
+int main() {
5
+ string s;
6
+ int cnt;
7
+ cout << "Enter the string: ";
8
+ cin >> s;
9
10
+ cnt = 0;
11
+ for ( char ch : s ) {
12
+ switch ( ch ) {
13
+ case 'a':
14
+ case 'e':
15
+ case 'i':
16
+ case 'o':
17
+ case 'u':
18
+ cnt++;
19
+ break;
20
+ default:
21
22
+ }
23
24
25
+ cout << "The string has " << cnt << " vowels.\n";
26
27
+ return 0;
28
+}
0 commit comments